An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' | |
| # Usually mina focuses on deploying to one host and the deploy options are therefore simple. | |
| # In our case, there is a number of possible servers to deploy to, it is therefore necessary to | |
| # specify the host that we are targeting. | |
| server = ENV['server'] | |
| # Since the same host can have multiple applications running in parallel, it is necessary to |
| require 'date' | |
| author = "Saito" | |
| email = "[email protected]" | |
| date = Date.new(2012, 7, 30) | |
| s = %w{ | |
| . . . . . . . | |
| . . o o o . . | |
| . o . . . . . |
| # /etc/init.d/nginx | |
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: nginx | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 |
| /* | |
| 12306 Auto Query => A javascript snippet to help you book tickets online. | |
| Copyright (C) 2011-2012 Jingqin Lynn | |
| Includes jQuery | |
| Copyright 2011, John Resig | |
| Dual licensed under the MIT or GPL Version 2 licenses. | |
| http://jquery.org/license | |
| Includes Sizzle.js |
| for_each_line_in_file(Name, Proc, Mode, Accum0) -> | |
| {ok, Device} = file:open(Name, Mode), | |
| for_each_line(Device, Proc, Accum0). | |
| for_each_line(Device, Proc, Accum) -> | |
| case io:get_line(Device, "") of | |
| eof -> file:close(Device), Accum; | |
| Line -> NewAccum = Proc(Line, Accum), | |
| for_each_line(Device, Proc, NewAccum) | |
| end. |
| // Exercise: Loops and Functions - http://tour.golang.org/#44 | |
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| func Sqrt(x float64) float64 { |
An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
| /* | |
| 12306 Auto Query => A javascript snippet to help you book tickets online. | |
| Copyright (C) 2011-2012 Jingqin Lynn | |
| Includes jQuery | |
| Copyright 2011, John Resig | |
| Dual licensed under the MIT or GPL Version 2 licenses. | |
| http://jquery.org/license | |
| Includes Sizzle.js |
| # coding: utf-8 | |
| require 'sinatra' | |
| set server: 'thin', connections: [] | |
| get '/' do | |
| halt erb(:login) unless params[:user] | |
| erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
| end | |
| get '/stream', provides: 'text/event-stream' do |