Skip to content

Instantly share code, notes, and snippets.

View jotafeldmann's full-sized avatar
🐙
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn

Jota Feldmann jotafeldmann

🐙
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
  • São Paulo, SP, Brazil
View GitHub Profile
@MarkVaughn
MarkVaughn / get_set_url_param.js
Created March 19, 2012 05:29
Get & Set URL parameter in Javascript
function getURLParameter(name) {
return decodeURIComponent(
(RegExp('[?|&]'+name + '=' + '(.+?)(&|$)').exec(location.search)||[null,null])[1]
);
}
function setURLParameter(name,value){
var search;
if(getURLParameter(name)){
search =location.search.replace(new RegExp('([?|&]'+name + '=)' + '(.+?)(&|$)'),"$1"+encodeURIComponent(value)+"$3");
}else if(location.search.length){
@ruby0x1
ruby0x1 / multi-player-html5-games-00-express.js
Created March 27, 2012 15:01
Multi-player games in HTML5
/* Copyright (c) 2012 Sven "FuzzYspo0N" Bergström
http://underscorediscovery.com
MIT Licensed. See LICENSE for full license.
Usage : node simplest.app.js
*/
var
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active April 15, 2024 14:27
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@willist
willist / sqlserver_setup.rst
Created May 23, 2012 14:14
Configuring SquirrelSQL and MSSQL
@jboner
jboner / latency.txt
Last active May 4, 2024 21:16
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@dannycroft
dannycroft / exclude-node-modules
Last active February 27, 2019 18:25
Exclude node_modules out of Sublime Text 2 searches
// Add the following to your preferences file
"folder_exclude_patterns":[".git","node_modules"]
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@19h
19h / pairingfunction.js
Last active November 12, 2018 20:08
Pairing Function for Javascript. Combines two numbers into one; used for compression of analytics data where two coordinates of mouse-clicks are combined into a single integer.
var pair = function (x, y) {
return x << 16 & 0xffff0000 | y & 0x0000ffff;
};
var depair = function (p) {
return [p >> 16 & 0xFFFF, p & 0xFFFF]
};
@prwhite
prwhite / Makefile
Last active May 2, 2024 18:02
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 3, 2024 12:59
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k