Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").
Author: Chris Jacob @_chrisjacob
Tutorial (Gist): https://gist.github.com/833223
| /** | |
| * A simple preforking echo server in C. | |
| * | |
| * Building: | |
| * | |
| * $ gcc -Wall -o echo echo.c | |
| * | |
| * Usage: | |
| * | |
| * $ ./echo |
| # unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| # 16 workers and 1 master | |
| worker_processes (rails_env == 'production' ? 16 : 4) | |
| # Load rails+github.git into the master before forking workers | |
| # for super-fast worker spawn times | |
| preload_app true |
| ## | |
| # test/spec/mini 5 | |
| # http://gist.github.com/307649 | |
| # [email protected] | |
| # | |
| def context(*args, &block) | |
| return super unless (name = args.first) && block | |
| require 'test/unit' | |
| klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do | |
| def self.test(name, &block) |
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| # This is an internal_redirect_to function by Sandro Paganotti | |
| # http://www.railsonwave.com/2008/10/25/how-to-call-a-controller-s-action-from-a-different-controller | |
| # By using this internal_redirect_to function you will be able to | |
| # get the same results as a normal redirect_to without send anything | |
| # to the user, only keep in mind to explicit invoke the return after | |
| # this function. | |
| class ApplicationController | |
| def internal_redirect_to (options={}) |
| ;; Automatically add, commit, and push when files change. | |
| (defvar autocommit-dir-set '() | |
| "Set of directories for which there is a pending timer job") | |
| (defun autocommit-schedule-commit (dn) | |
| "Schedule an autocommit (and push) if one is not already scheduled for the given dir." | |
| (if (null (member dn autocommit-dir-set)) | |
| (progn | |
| (run-with-idle-timer |
| # | |
| # A C Parser using the Parslet library. | |
| # | |
| # ANSI C Grammar: | |
| # | |
| # * http://www.lysator.liu.se/c/ANSI-C-grammar-l.html | |
| # * http://www.lysator.liu.se/c/ANSI-C-grammar-y.html | |
| # | |
| require 'parslet' |
| ############################################################################ | |
| # _ | |
| # | |_ _ __ ___ _ ___ __ | |
| # | __| '_ ` _ \| | | \ \/ / | |
| # | |_| | | | | | |_| |> < | |
| # \__|_| |_| |_|\__,_/_/\_\ | |
| # | |
| # Cheatsheets: | |
| # https://devhints.io/tmux | |
| # `property not found` issue: |
Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").
Author: Chris Jacob @_chrisjacob
Tutorial (Gist): https://gist.github.com/833223
| #include <string.h> | |
| #include <uthash.h> | |
| // this is an example of how to do a LRU cache in C using uthash | |
| // http://uthash.sourceforge.net/ | |
| // by Jehiah Czebotar 2011 - [email protected] | |
| // this code is in the public domain http://unlicense.org/ | |
| #define MAX_CACHE_SIZE 100000 |