Skip to content

Instantly share code, notes, and snippets.

View RichardLitt's full-sized avatar

Richard Littauer RichardLitt

View GitHub Profile
@RichardLitt
RichardLitt / gist:d6513707efdb7926ab04
Created February 18, 2015 00:45
Broken test in static-module
// Works: https://github.com/substack/static-module/blob/master/test/brfs/attribute_vars.js
var x = 5, f = require('fs').readFileSync, y = 2;
var src = f(__dirname + '/x.txt', 'utf8');
console.log(src);
// Broken:
var x = 5, fs = require('fs'), y = 2;
var src = fs.readFileSync(__dirname + '/x.txt', 'utf8');
console.log(src);
@RichardLitt
RichardLitt / gist:d188954e5d3ee7fb0a93
Created December 19, 2014 00:37
How to show a radioactive icon if the current dir has a git stash
parse_git_stash() {
[[ $(git stash list 2> /dev/null | tail -n1) != "" ]] && echo ' \[\e[0;31m\]☣'
}
set_bash_prompt(){
PS1="\A \w$(parse_git_stash) \[\e[0m\]$ "
}
PROMPT_COMMAND=set_bash_prompt
var iterator = 10;
iLoop: for (var i = 0; i < iterator; i++) {
yLoop: for (var y = 0; y < iterator; y++ ) {
console.log('i and y:', i, y)
testing: if (y==5) {
console.log('This will break the outside loop!');
break iLoop;
console.log('This will never appear.');
}
14:18 ~/src/beaglelabs/beagle $ grep react node_modules/react*/package.json
node_modules/react-async/package.json: "name": "react-async",
node_modules/react-async/package.json: "react": "~0.11.0"
node_modules/react-async/package.json: "react": "~0.11.0",
node_modules/react-async/package.json: "url": "git://github.com/andreypopp/react-async"
node_modules/react-async/package.json: "react-component",
node_modules/react-async/package.json: "react"
node_modules/react-async/package.json: "url": "https://github.com/andreypopp/react-async/issues"
node_modules/react-async/package.json: "homepage": "https://github.com/andreypopp/react-async",
node_modules/react-async/package.json: "_id": "react-async@1.0.2",
14:16 ~/src/beaglelabs/beagle $ npm ls
npm WARN unmet dependency /Users/richard/src/beaglelabs/beagle/node_modules/gulp-react requires react-tools@'^0.11.2' but will load
npm WARN unmet dependency /Users/richard/src/beaglelabs/beagle/node_modules/react-tools,
npm WARN unmet dependency which is version 0.12.1
npm WARN unmet dependency /Users/richard/src/beaglelabs/beagle/node_modules/browserify/node_modules/crypto-browserify/node_modules/sha.js requires buffer@'~2.3.2' but will load
npm WARN unmet dependency /Users/richard/src/beaglelabs/beagle/node_modules/browserify/node_modules/buffer,
npm WARN unmet dependency which is version 2.8.1
beagle@0.0.0 /Users/richard/src/beaglelabs/beagle
├─┬ beagle-altmetrics@0.0.2 -> /Users/richard/src/beaglelabs/beagle-altmetrics
│ ├─┬ accum-transform@1.0.2
## Places Model
Class Places
# I added through Houses, removed depdendent: :destroy (see comment)
has_many :campsites, dependent: :destroy
#has_many :days, dependent: :destroy
has_many :days, through: :houses
end
var fs = require('fs');
var _ = require('underscore');
// Init
var sidebarOpen = false;
// TODO Enable Static Assets to go to other Views besides SideBar
function buildStaticAssets(modules){
// Init
var fs = require('fs');
var _ = require('underscore');
// Init
var sidebarOpen = false;
// TODO Enable Static Assets to go to other Views besides SideBar
function buildStaticAssets(modules){
// Init
var test = {
filters: {
filterOne: [
{},
{},
],
filterTwo: [...]
}
},
otherkey: "",
class ParkFeature < ActiveRecord::Base
self.table_name = 'parks_features'
belongs_to :park
belongs_to :feature
end
class Feature < ActiveRecord::Base
has_many :park_features
has_many :parks, through: :park_features