Skip to content

Instantly share code, notes, and snippets.

@thevangelist
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
@billroy
billroy / jsonio.py
Created September 21, 2012 13:38
Read/write JSON object from file in python
import simplejson
import json
def put(data, filename):
try:
jsondata = simplejson.dumps(data, indent=4, skipkeys=True, sort_keys=True)
fd = open(filename, 'w')
fd.write(jsondata)
fd.close()
except:
@jnwhiteh
jnwhiteh / install-ljitrocks.sh
Created August 4, 2011 14:49
Install luajit+luarocks in sandboxed environment
#!/usr/bin/env bash
set -e
die() {
echo "$1";
exit 1;
}
# Fetch and install LuaJIT/LuaRocks into the local directory
@mfikes
mfikes / source.md
Last active December 27, 2016 20:04
Source for C and ClojureScript comparison
@FiloSottile
FiloSottile / categorizing.sql
Created July 2, 2016 23:32
Go vendoring BigQuery
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE f.path LIKE 'Godeps/_workspace/%'
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f