Oct 16 2010
- 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments
In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].
| <?php | |
| require_once 'decamelize.php'; | |
| class TestDecamelize extends PHPUnit_Framework_TestCase | |
| { | |
| public function testOneCamel() | |
| { | |
| $rs = decamelize("camelCase"); | |
| $this->assertEquals($rs[0], "camel"); |
| ##### GIT | |
| # Removes all local branch | |
| for branch in $(git branch | grep "feature/MAGENTA-"); do git branch -D $branch; done | |
| # Remove all new files | |
| for file in $(git status | grep "new file" | sed "s/#\tnew file://"); do git rm --cached $file; done | |
| # Delete all remote branches | |
| for remote_branch in $(git ls-remote); do if [[ $remote_branch =~ .*(feature/MAGENTA-([0-9|^130]).+).* ]]; then git push origin :${BASH_REMATCH[1]}; fi; done |
| # Change ACL on the app/logs and app/cache directories | |
| after 'deploy', 'deploy:update_acl' | |
| # This is a custom task to set the ACL on the app/logs and app/cache directories | |
| namespace :deploy do | |
| task :update_acl, :roles => :app do | |
| shared_dirs = [ | |
| app_path + "/logs", |
| tv-testall() { | |
| if [ $(pwd) != "/home/prouudlygeek/github/BookingSandbox" ]; then | |
| echo -n "terravision test command failed: you are not in the correct path " | |
| pwd | |
| return 1 | |
| fi | |
| php app/console doctrine:database:drop --env="test" --force | |
| php app/console doctrine:database:create --env="test" | |
| php app/console doctrine:schema:create --env="test" | |
| php app/console doctrine:fixtures:load --env="test" |
| Flask 0.8 | |
| ========= | |
| ``` | |
| Server Software: Werkzeug/0.8.3 | |
| Server Hostname: localhost | |
| Server Port: 5000 | |
| Document Path: / | |
| Document Length: 21 bytes |
| #include <stdio.h> | |
| // The original function (adds two number and sets | |
| // the results into the first one | |
| void add(int *x, int *y) | |
| { | |
| *x = *x + *y; | |
| } | |
| void sub(int *x, int *y) |
| (extend-type js/RegExp | |
| cljs.core.IFn | |
| (-invoke ([this s] (re-matches this s)))) | |
| (#"foo.*" "foobar") ;=> "foobar" | |
| (#"zoo.*" "foobar") ;=> nil | |
| (filter #".*foo.*" ["foobar" "goobar" "foobaz"]) ;=> ("foobar" "foobaz") |
| brew install rbenv | |
| brew install ruby-build | |
| brew install --HEAD https://raw.github.com/jasoncodes/homebrew/rbenv-vars/Library/Formula/rbenv-vars.rb # https://github.com/mxcl/homebrew/pull/7891 | |
| brew install readline | |
| echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile | |
| exec $SHELL -i # reload the shell | |
| CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p125 | |
| rbenv global 1.9.3-p125 | |
| gem install bundler -v '~> 1.0.pre' | |
| gem install git-up hitch gem-browse gem-ctags cheat awesome_print pry |
| # Map alphabet letter to numbers 1 | |
| Hash[("a".."z").map.with_index {|x, i| [x, i] }] | |
| # |