Skip to content

Instantly share code, notes, and snippets.

@w33ble
w33ble / common.txt
Created February 20, 2014 03:08
cjs via require example
// commonjs pattern
define(function(require) {
var $ = require('jquery');
// Replaces the 'shorthand' function from the first example
// This is returned as a module to the require call
return {
show: function() {
$('.loading-overlay').removeClass('hidden');
},
@w33ble
w33ble / require.txt
Created February 20, 2014 03:11
sort of cleaner require example
// require pattern
var deps = [
'jquery',
'lodash',
'backbone'
];
define(deps, function($, _, Backbone) {
// Replaces the 'shorthand' function from the first example
// This is returned as a module to the require call
@w33ble
w33ble / app.js
Last active August 29, 2015 13:57
Gravitar Avatar React Component
define(function(require, exports, module){
var React = require('react');
var Avatar = require('avatar');
return React.renderComponent(Avatar({ email: '[email protected]' }), document.querySelector('body'));
});
@w33ble
w33ble / 01.coffee
Created May 28, 2014 23:06
Ugly Bookshelf and Knex.raw example
# bookshelf code, to compliment the knex code above
exports.PG = Bookshelf.PG = Bookshelf.initialize
client: 'pg'
connection: config.get('/postgres')
# property photo model
exports.PropertyPhoto = PropertyPhoto = Bookshelf.PG.Model.extend
tableName: 'property_photos'
@w33ble
w33ble / gist:c6f4c0181f276d3cef87
Created July 14, 2014 00:26
Pete Hunt React Reddit Comment

Hey, I'm the React zealot on Reddit (slash on the core team :)) I expect lots of debate from this :)

I wrote a blog post a while ago about this: http://www.quora.com/Pete-Hunt/Posts/Facebooks-React-vs-AngularJS-A-Closer-Look[22]

First of all I think it's important to evaluate technologies on objective rather than subjective features. "It feels nicer" or "it's cleaner" aren't valid reasons: performance, modularity, community size and ease of testing / integration with other tools are.

I've done a lot of work benchmarking, building apps, and reading the code of Angular to try to come up with a reasonable comparison between their ways of doing things.

Community / project maturity

@w33ble
w33ble / Vagrantfile
Last active August 29, 2015 14:04
Simple shell-based Vagrant setup for ElasticSearch
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provision :shell, :path => "provision.sh"
config.vm.network :forwarded_port, host: 9200, guest: 9200
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "60", "--cpus", "1"]
vb.memory = 512
end
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
ddoollooodddxxxxddollodxxdllodoooodddoddlcldddddddooddoodddddollllldxxdddooo
xdxxxddddlloxxxxxxxdddxxxxodxdooooddddddoodddddddddddddddddddolloddxxxxxdood
xddddxxddooloooodxxxxdxxxxxxxoloddddddddddddddddddddddddddddddddxxxdoddddodd
ddllooddddolllooxxxxdxxxxdxxddddddddddddddddddxdddxddddddxxdddddxxxdloxxxxxx
lloddddddoodddxxxxxxxxxxxdddddddddddddddddddddddddxxddddxxddddddddddoodxxxxx
ooddolooooodxxxxdoodddddddddddddddddddddddddxdxxxdxxxdddddddddddxdxxoodxxdxd
ddxdolloddoodddddodddddddddoddddddddxdddxxxxxddxxddxxxddxxdddddddddxxxxdddxd
xdxdoloodxdooodddxdddddddddodddxxxdxxdddxdddddddddddddddddddddddddddxxxddddd
dddddxdlloddddxddxdddddddddddddxxxxxxdddxxdddddddddddddddddddddddxdddddddddd
lllodxdllllodxxxddddddddddddddddxxxxdddddddddddddddddddddddddddddddddxxddddd
@w33ble
w33ble / Planning.md
Last active August 29, 2015 14:14
Enhance Planning and Post-mortem Notes

Enhance

Technology

  • Webpack
    • Web Components - webcomponents.js
    • ES6 - 6to5 transpiler
    • Less
  • Page.js
@w33ble
w33ble / book_of_chris.md
Last active August 29, 2015 14:15
The Book of Chris™
  • Templates are not a separation of concerns, it's a separation of technologies
  • Smart people look things up, dumb people make things up

Stuff that happened at work

  • Weekly meeting where we share useful tech & tips
  • Arguing about these buttons is like looking at a witch and arguing about removing a single wart
  • The coffee nap
  • Eventually consistent = eventually messed up
  • "Making Charts and Breaking Hearts!"