Skip to content

Instantly share code, notes, and snippets.

View qodeninja's full-sized avatar
🐍
snek

Qodeninja qodeninja

🐍
snek
  • San Francisco
View GitHub Profile
@qodeninja
qodeninja / iife-variable-context.js
Last active August 29, 2015 14:11
Understanding IIFE - preserve the context of a variable by immediately executing function
var y = 100;
//immediate invocation outside of expression
var fnx = (function fn( x ){
return 'save context : fnx=' + (x+y);
})(y);
//immediate invocation inside of expression
var fny = (function fny( x ){
return 'save context : fny=' + (x+y);
@qodeninja
qodeninja / gist:7ca09823dee5e8dc839f
Created May 29, 2015 16:04
Python - simple words in a file histogram (sorted by count)
def load_data_file():
with open('data.in') as f:
for line in f:
words = line.split()
for word in words:
if histogram[word] is not None:
histogram[word]+=1
print "Already found ({}) {}".format(word,histogram[word])
else:
histogram[word]=0
a
abbr
acronym
address
applet
area
article
aside
audio
b
accesskey
class
contenteditable
contextmenu
data-*
dir
draggable
dropzone
hidden
id
accept
accept-charset
accesskey
action
align
alt
async
autocomplete
autofocus
autoplay
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';

Keybase proof

I hereby claim:

  • I am qodeninja on github.
  • I am qodeninja (https://keybase.io/qodeninja) on keybase.
  • I have a public key whose fingerprint is 7071 4F49 9A60 1036 920F 8013 5A20 C8FE 7D8E 6FD6

To claim this, I am signing this object:

@qodeninja
qodeninja / errno.h
Created July 22, 2017 00:05
Linux Error Codes
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Argument list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No child processes */
alice-blue F0F8FF 240 248 255 231
antique-white FAEBD7 250 235 215 230
aqua 00FFFF 0 255 255 051
aquamarine 7FFFD4 127 255 212 122
azure F0FFFF 240 255 255 231
beige F5F5DC 245 245 220 230
bisque FFE4C4 255 228 196 224
black 000000 0 0 0 016
blanched-almond FFEBCD 255 235 205 230
blue 0000FF 0 0 255 021
@qodeninja
qodeninja / color-term-256.db
Last active July 22, 2017 00:07
Xterm Color DB
black 000000 0 0 0 016
maroo 800000 128 0 0 088
green 008000 0 128 0 028
olive 808000 128 128 0 100
navy 000080 0 0 128 018
purple 800080 128 0 128 090
teal 008080 0 128 128 030
silver C0C0C0 192 192 192 145
grey 808080 128 128 128 102
red FF0000 255 0 0 196