This file contains 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
def formatted_address(order, nl="\n") | |
name = strip_extra_spaces(order.name) | |
addr1 = strip_extra_spaces(order.addr1) | |
addr2 = order.addr2.blank? ? '' : strip_extra_spaces(order.addr2) | |
city = order.city.blank? ? '' : strip_extra_spaces(order.city) | |
county = order.county.blank? ? '' : strip_extra_spaces(order.county) | |
postcode = order.postcode.blank? ? '' : strip_extra_spaces(order.postcode) | |
country = order.country |
This file contains 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
BSD MONOP(6) | |
NAME | |
monop - Monopoly game | |
SYNOPSIS | |
/usr/games/monop | |
DESCRIPTION | |
monop is reminiscent of the Parker Brothers game Monopoly for 1 to 9 | |
players. The program assumes that the rules of Monopoly are known. It | |
follows the standard rules, with the exception that if a property goes up | |
for auction and there are only two solvent players, no auction is held |
This file contains 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 AccountsController < ApplicationController | |
def new | |
@account = Account.new | |
end | |
def create | |
@account = Account.new(params[:account]) | |
if @account.save | |
redirect_to @account, notice: 'Account was successfully created.' | |
else |
This file contains 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
def find_pair(array, value) | |
lookup = {} | |
array.each_with_index do |i, index| | |
if i < value | |
search = value - i | |
i2 = lookup[search] | |
if i2 then return [i2, i] else lookup[i] = index end | |
end | |
end | |
return nil |
This file contains 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
#!/usr/local/bin/perl | |
while (chomp($t=)){ | |
$c=1; $d=1; @b=(); | |
foreach (split(/;/,$ARGV[0])){ | |
if( /^al/ ){ tr/0-9//cd; $c-=$_; $c=1 if $c<1; } | |
elsif( /^ar/ ){ tr/0-9//cd; $c+=$_; } | |
elsif( /^tl/ ){ $c=1; } | |
elsif( /^tr/ ){ $c=length $t; } | |
elsif( /^go/ ){ tr/0-9//cd; $c=$_; } | |
elsif( /^cb/ ){ @b=(); } |
This file contains 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 file contains 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
stack = [] | |
stored_string = "" | |
random_choices = [] | |
scanner = StringScanner.new(text) | |
while match = scanner.scan_until(/[\{\}\|]|\[(one of|or|at random)\]/) | |
stored_string << match.slice(0, match.length - scanner.matched_size) | |
case scanner.matched | |
when "{", "[one of]" | |
stack.push([random_choices, stored_string]) |
This file contains 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
module Test | |
def hello | |
self.bye | |
end | |
def self.extended(base) | |
puts base.hello | |
end | |
end |
This file contains 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
/* draw_scene.c | |
* | |
* Code to draw the main scene when in flight | |
* | |
*/ | |
#include "main.h" | |
/* highly unoptimised scene rendering */ | |
void draw_scene( void ) | |
{ |
This file contains 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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, user = require('./routes/user') | |
, http = require('http') | |
, path = require('path') |
OlderNewer