This file contains hidden or 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
| # Hot deploy Rails apps (rolling restart) with Capistrano, Haproxy, and cluster of Passengers | |
| # Capistrano config | |
| namespace :passenger do | |
| task :disable_load_balancing, :roles => :app do | |
| run "rm -f #{current_path}/public/http-check.txt" | |
| end | |
| task :enable_load_balancing, :roles => :app do |
This file contains hidden or 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
| source 'http://rubygems.org' | |
| gem 'rails', '3.0.0.beta3' | |
| gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' | |
| gem 'haml', '3.0.0.rc.4' | |
| gem 'will_paginate', '3.0.pre' | |
| group :test do | |
| gem 'capybara', '0.3.7' | |
| gem 'database_cleaner', '0.5.2' |
This file contains hidden or 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
| This is a normal conversation between a friend and I: | |
| Chris | |
| 3:45 | |
| Having had a few smart phones I have enough experience to know their merits and their fallacies. | |
| Matthew | |
| 3:46 | |
| Having owned several computers I know enough to take them apart to increase my gigawatts |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| void create_node(char* property_list) { | |
| char* item; | |
| char* list; | |
| const char *end = property_list; | |
| while(*end) |
This file contains hidden or 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
| class BrainfuckInterpreter | |
| def initialize(program) | |
| @memory = Array.new(255) { 0 } # 255 memory cells | |
| @m_ptr = 0 # memory pointer: which cell | |
| @i_ptr_stack = Array.new # instruction pointer stack: used for loops and nested loops | |
| @i_ptr = 0 # instruction pointer: which instruction | |
| @program = program | |
| end | |
| def run |
This file contains hidden or 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
| class Mastermind | |
| attr_accessor :actual, :title | |
| def initialize | |
| @actual = [rand(6) + 1, rand(6) + 1, rand(6) + 1, rand(6) + 1] | |
| @title = "Mastermind" | |
| end | |
| def play | |
| display_title |
This file contains hidden or 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
| push 5 | |
| ifeq 4 | |
| jump 8 | |
| push -1 | |
| add | |
| jump 2 | |
This file contains hidden or 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
| (ns poker.core) | |
| (def suits ['C 'D 'H 'S]) | |
| (def values ['A '2 '3 '4 '5 '6 '7 '8 '9 'T 'J 'Q 'K]) | |
| (def deck (map (fn [i] [(rem i 13) (quot i 13)]) (range 52))) | |
| (defn format-card [card] | |
| (apply str (map get [values suits] card))) | |
| (defn low-card [hand] |
This file contains hidden or 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
| #include <ncurses.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| enum mode { | |
| NORMAL, | |
| INSERT, | |
| COMMAND | |
| }; |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>WebGL Example</title> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/gl-matrix/2.2.1/gl-matrix-min.js"></script> | |
| <script id="shader-fs" type="x-shader/x-fragment"> | |
| precision mediump float; | |
| void main(void) { |
OlderNewer