This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# simple command line application and utility library for building modular flask applications. | |
# Just drop me in your root, chmod +x ./testserver.py, and ./flaskr.py init | |
# then you can chmod +x ./testserver.py and ./testserver.py to run it. | |
# finally create new modules using ./flaskr new module-name and add | |
# the name to mods.py. | |
# v0.0.1 | |
def build_flask(config): | |
from flask import Flask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* vi: set syntax=javascript : | |
* vi: set tabstop=2 : | |
* vi: set expandtab : | |
*/ | |
var dust = require('dustjs-linkedin'), | |
fs = require("fs"), | |
Glob = require("glob").Glob, | |
path = require('path'), | |
async = require('async') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-centos-6-with-rvm | |
sudo yum update | |
sudo yum install curl git | |
curl -L get.rvm.io | bash -s stable | |
source ~/.rvm/scripts/rvm | |
rvm requirements | |
rvmsudo yum install -y ... | |
rvm install 1.9.3 | |
rvm use 1.9.3 --default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FIND="find";find --version > /dev/null 2>&1 || FIND="gfind" | |
$FIND ... | |
or | |
ARGS="-iname ... -o -iname ..."; find --version > /dev/null 2>&1 && find $ARGS || gfind $ARGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Order.class_eval do | |
# or before_transition | |
state_machine.after_transition :to => 'complete' do |order| | |
... | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# An assumption is that our stash stack is already empty, otherwise a | |
# git stash && git stash pop | |
# would pop stacks even if git stash failed to save anything. | |
# (git stash could return a non-zero on 'no stash created' BUT it doesn't (yet) ) | |
# store local changes | |
git stash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1..100).each { |x| puts( (eval(("'Fizz'" if x % 3 == 0).to_s + ("'Buzz'" if x % 5 == 0).to_s) or x) ) } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
even_numbers,odd_numbers,starts_with_one = entire = (1..10).map do |x| | |
[ (x if x % 2 == 0) ,(x if x % 2 != 0), (x if x.to_s[0] == '1') ] | |
end.transpose.map { |x| x.compact } | |
# The entities within the map [ ..., ..., ..N] end up in their respective list | |
# variables. compact is for removing nils from the resulting nested lists. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Modelling traffic lights as a persistent finite state machine using | |
* state-machine.js and nodejs. | |
*/ | |
/* | |
* This is a specialization of Object.extend that checks if the | |
* destination function exists, and if so, merges the two functions | |
* into one function. This allows two conflicting functions | |
* to become a series of procedural steps. |
OlderNewer