Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / jq_vs_js.md
Last active April 12, 2025 09:10
Comparison of jQuery and vanilla JS for basic DOM manipulation.

jQuery vs native JS

Selecting Elements

var divs = $("div");

var divs = document.querySelectorAll("div");
@joyrexus
joyrexus / solarized-light.css
Created April 5, 2013 21:23
Solarized-light theme for pygments-based highlighting.
.highlight { background-color: #ffffcc }
.highlight .c { color: #586E75 } /* Comment */
.highlight .err { color: #93A1A1 } /* Error */
.highlight .g { color: #93A1A1 } /* Generic */
.highlight .k { color: #859900 } /* Keyword */
.highlight .l { color: #93A1A1 } /* Literal */
.highlight .n { color: #93A1A1 } /* Name */
.highlight .o { color: #859900 } /* Operator */
.highlight .x { color: #CB4B16 } /* Other */
.highlight .p { color: #93A1A1 } /* Punctuation */
@joyrexus
joyrexus / .ctags
Last active December 15, 2015 20:59
.ctags for coffee and javascript.
--tag-relative=yes
--exclude=.git
--langdef=js
--langmap=js:.js
--regex-js=/([A-Za-z0-9_$]+)[ \t]*[:=][ \t]*function[A-Za-z0-9_$ \t]*\(/\1/f, function,
functions/
--regex-js=/\[[ \t]*['"]([A-Za-z0-9_$ ]+)['"][ \t]*\][ \t]*=[ \t]*function[A-Za-z0-9_$
\t]*\(/\1/f, function, functions/
--regex-js=/['"]([A-Za-z0-9_$ ]+)['"][ \t]*:[ \t]*function[A-Za-z0-9_$ \t]*\(/\1/f,
@joyrexus
joyrexus / Makefile
Created April 5, 2013 22:00
Sample Makefile for simple coffee-driven webapps.
DEPLOY_DIR = $(WEBDOCS)/project/demo
.PHONY: build deploy
SOURCES := $(wildcard src/*.coffee)
build: $(SOURCES)
coffee -co lib/ src/
@echo "coffee sources were compiled"
@joyrexus
joyrexus / README.md
Last active December 15, 2015 23:29
Guides and tips for iOS web app development.
@joyrexus
joyrexus / config.html
Last active December 15, 2015 23:29
iOS web app config settings.
<!-- cache items specified in manifest -->
<html manifest="app.manifest">
<!-- standalone mode, hides web browser UI -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- optimized for mobile, zoom/scaling disabled -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.
0, user-scalable=no" />
@joyrexus
joyrexus / demo.html
Last active September 6, 2018 09:29
Pure CSS3 toggle switch.
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="toggle.css">
<style>
#status {
margin: 50px;
font-size: 300px;
font-family: 'Helvetica Neue';
font-weight: 100;
color: #555;
@joyrexus
joyrexus / filter.coffee
Last active December 16, 2015 03:19
Sample unix-style filter that reads from STDIN sans args.
#!/usr/bin/env coffee
fs = require 'fs'
transform = (data) ->
result = data.toString().replace /h/g, 'm'
process.stdout.write result
if process.argv.length > 2
transform fs.readFileSync(file, 'utf8') for file in process.argv[2..]
else
@joyrexus
joyrexus / power.coffee
Last active December 16, 2015 10:58
Powerset implementations in coffeescript.
powerset = (S) ->
P = [[]]
P.push P[j].concat S[i] for j of P for i of S
P
@joyrexus
joyrexus / alias_deco.py
Created April 20, 2013 17:52
Decorator for aliasing class methods.
def aliased(klass):
'''
Decorator to be used in combination with `@alias` decorator.
Classes decorated with @aliased will have their aliased methods
(via @alias) actually aliased.
'''
methods = klass.__dict__.copy()
for name, method in methods.iteritems():