Skip to content

Instantly share code, notes, and snippets.

@gustavohenke
gustavohenke / svg2png.js
Created February 18, 2014 15:27
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@ssskip
ssskip / ISO3166-1.alpha2.json
Last active May 8, 2024 03:21
json of country codes (ISO 3166-1 alpha-2) and corresponding names
{
"AF": "Afghanistan",
"AX": "Aland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@mrbar42
mrbar42 / README.md
Last active May 8, 2024 03:20
Install nodenv on Ubuntu

Installing nodenv on ubuntu

nodenv is a great tool, but its installation on Ubuntu is never smooth for me. Here are instructions to install nodenv along with node-build and node-aliases plugins.

ℹ️ note - nodenv recommands updating the PATH though not all programs run in a shell. i prefer adding symlinks to the nodenv binary and shims to make it available everywhere.

The script can be pasted into a terminal as is

# install the base app
@hasanalisiseci
hasanalisiseci / HalfSheetWithUIKitForSwiftUI.swift
Created December 23, 2023 11:02
Half Sheet with UIKit for SwiftUI
//
// HalfSheetWithUIKitForSwiftUI.swift
// TestAppForNewThinks
//
// Created by Hasan Ali Şişeci on 23.12.2023.
//
import SwiftUI
extension View {
i
me
my
myself
we
our
ours
ourselves
you
your
@bernardopacheco
bernardopacheco / 00_README.md
Last active May 8, 2024 03:17
Unity Event Manager event-driven architecture.

Unity Event Manager

This Gist represents an event-driven architecture that helps to structure my games in Unity. It uses events to trigger and communicate between decoupled parts of a game.

Usage

In the first game scene, create an empty Game Object named EventManager and attach the EventManager.cs script to it. This script is set to DontDestroyOnLoad, i.e., it won't be destroyed when reloading scene.

The Producer.cs and Consumer.cs classes show how an event is published and consumed. In this example, when a coin is collected, an addCoins event is published with the collected amount. A Consumer receives the amount of coins collected and update its own coins amount.

@mda590
mda590 / stress_test.py
Created June 8, 2018 14:07
Python script useful for stress testing systems
"""
Produces load on all available CPU cores.
Requires system environment var STRESS_MINS to be set.
"""
from multiprocessing import Pool
from multiprocessing import cpu_count
import time
import os
@Dev-Dipesh
Dev-Dipesh / image.md
Last active May 8, 2024 03:16
Javascript loops can be quite confusing. Knowing the write loop to use can make a big difference in performance.

A4 Image file if you would like to print it ♥ JS Loops Cheatsheet

@Haythamasalama
Haythamasalama / createTopicsTelegram.js
Created August 18, 2023 17:44
Automated Telegram Topic Generation using JavaScript
const subjects = [
{
name: "Quizzes",
icon_custom_emoji_id: "5433614043006903194",
text: "Quizzes Topic",
},
// etc
];
const telegramToken = "";
const chatId = "";