An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
| Failures: | |
| 1) MicropostsController POST 'create' failure should render the home page | |
| Failure/Error: response.should render_template('pages/home') | |
| expecting <"pages/home"> but rendering with <""> | |
| # ./spec/controllers/microposts_controller_spec.rb:38:in `block (4 levels) in <top (required)>' | |
| 2) MicropostsController POST 'create' success should create a micropost | |
| Failure/Error: lambda do | |
| count should have been changed by 1, but was changed by 0 |
| class User | |
| include Mongoid::Document | |
| include Mongoid::Timestamps | |
| devise :database_authenticatable, :registerable, | |
| :recoverable, :rememberable, :trackable, :validatable | |
| has_one :profile, :class_name => 'Profile', :foreign_key => :person_id |
| check_browser: (navigator) -> | |
| N = navigator.appName | |
| ua = navigator.userAgent | |
| tem = undefined | |
| M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i) | |
| M[2] = tem[1] if M and (tem = ua.match(/version\/([\.\d]+)/i))? | |
| M = (if M then [M[1], M[2]] else [N, navigator.appVersion, "-?"]) | |
| M |
| // overriding sync to use local storage when possible | |
| sync : function(method, model, options){ | |
| var key, now, timestamp, refresh; | |
| if(method === 'read' && this.constants.isStoredInLocalStorage) { | |
| // only override sync if it is a fetch('read') request | |
| key = this.getKey(); | |
| if(key) { | |
| now = new Date().getTime(); | |
| timestamp = $storage.get(key + ":timestamp"); | |
| refresh = options.forceRefresh; |
An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| ### BEGIN INIT INFO | |
| # Provides: Xvfb | |
| # Required-Start: $local_fs $remote_fs | |
| # Required-Stop: | |
| # X-Start-Before: | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Loads X Virtual Frame Buffer | |
| ### END INIT INFO |
To run this, you can try:
curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash
I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.
Alternatively,
curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <style type="text/css" media="all"> | |
| #main { | |
| width: 300px; | |
| height: 400px; | |
| overflow: scroll; | |
| } |