Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jjt's full-sized avatar
⚔️
J̷̷͓̱͙͕̗A̖̟̰̭͎̹̱̮ͅV̷͔̩̜̭̝̫̯͝ͅA̛̘͟S̯̭̱̹͎̩̭̯C̮̪͙͈͘R̴̯̬̣̟̯̻͞I̡̖̣̬̤̰̬̦͟Ṕ̨̹̫̩̞͍Ţ̝̦

Jason Trill jjt

⚔️
J̷̷͓̱͙͕̗A̖̟̰̭͎̹̱̮ͅV̷͔̩̜̭̝̫̯͝ͅA̛̘͟S̯̭̱̹͎̩̭̯C̮̪͙͈͘R̴̯̬̣̟̯̻͞I̡̖̣̬̤̰̬̦͟Ṕ̨̹̫̩̞͍Ţ̝̦
View GitHub Profile
@jjt
jjt / not-so-dry.js
Created August 9, 2012 18:36
RequireJS "global" dependencies
// Not so DRY:
// module_1.js
define(["underscore", "zepto", "momentjs",...], function(_, $, Moment, ... ) {
// ...
});
// module_2.js
define(["underscore", "zepto", "momentjs",...], function(_, $, Moment, ... ) {
// ...
### Keybase proof
I hereby claim:
* I am jjt on github.
* I am jjt (https://keybase.io/jjt) on keybase.
* I have a public key ASC7tyxfJkEt9vwUgdJMibC20QE09FG5u1xn-4-gnjqqaAo
To claim this, I am signing this object:
@jjt
jjt / compile.sh
Created June 1, 2012 17:55
Example: Running multiple background processes in one bash script, killing all on SIGINT (ctrl+c)
#!/bin/bash
SITE=/home/dev/sites/rmx
# Arbitrary shell commands, some run in background
echo "RMX using siteroot=$SITE"
$SITE/rmx/manage.py runserver &
compass watch $SITE/media/compass/ &
coffee -o $SITE/media/js -cw $SITE/media/coffee &
hamlpy-watcher $SITE/templates/hamlpy $SITE/templates/templates &
@jjt
jjt / jjt-symbolmod-layout.json
Last active April 26, 2016 06:18
ErgoDox colemak-symbolmod layout for the Keyboard Layout Tool
{
"label": "Ergodox Colemak jjt-symbolmod",
"fingerStart": {
"1": 29,
"2": 30,
"3": 31,
"4": 32,
"5": 66,
"6": 75,
"7": 35,
@jjt
jjt / hs-vs-jsx.js
Created March 22, 2016 16:56
React Hyperscript vs JSX
h('div.example', [
h('h1#heading', 'This is hyperscript'),
h('h2', 'creating React.js markup'),
h(AnotherComponent, {foo: 'bar'}, [
h('li', [
h('a', {href: 'http://whatever.com'}, 'One list item')
]),
h('li', 'Another list item')
])

3. Component state

01-component-state
  • Slide, then...
  • Difference between props and state is change over time. If I were a React component, my name is a good property because that isn't likely to change. My level of thirst is good state, because that changes
03-set-state
  • Slide, then...
  • setState is passed an object with keys that you want to change. In this example, it would be incrementing this.state.counter by one. This component might have other pieces of state, but this call to setState doesn't affect them
[gulp] Running 'react'...
[gulp] Finished 'react' in 2.28 ms
... Reload /Users/jjt/Sites/LUXTRUBUK/client/src/jsx/index.js ...
... Reload /Users/jjt/Sites/LUXTRUBUK/client/src/jsx/luxtrubuk.js ...
[gulp] Running 'browserify'...
[gulp] Finished 'browserify' in 461 μs
[gulp] Running 'browserify'...
[gulp] Finished 'browserify' in 310 μs
[gulp] Running 'react'...
[gulp] Finished 'react' in 831 μs
module.exports = (grunt) ->
# Path to bower module
# ex. bower 'pure' == 'public/bower_components/pure'
bower = (str) ->
"public/bower_components/#{str}"
grunt.initConfig
# Pure is great, but I want to import the css files in scss files
# So this takes the copy from Bower and makes *.scss files from them
copy:
@jjt
jjt / Makefile
Created September 26, 2013 18:43 — forked from puzrin/Makefile
# Edit here - set path to you directory with config.json & fonts
FONT_DIR ?= ./assets/vendor/fontello/src
### Don't edit below ###
FONTELLO_HOST ?= http://fontello.com
fontopen:
@if test ! `which curl` ; then \
@jjt
jjt / nginx.conf
Created August 10, 2012 06:09
nginx server block for static root + django proxy
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}