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
<?php | |
/** | |
* Controller is the customized base controller class. | |
* All controller classes for this application should extend from this base class. | |
*/ | |
class Controller extends CController | |
{ | |
// Rest of the Controller class |
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
# Helper for PostgreSQL Sequences | |
# USAGE: | |
# SequenceHelper.nextval('somenumber_seq') | |
# SequenceHelper.currval('somenumber_seq') | |
# SequenceHelper.reset('somenumber_seq', 10) | |
class SequenceHelper < ActiveRecord::Base | |
# Verify that the sequence exists or create it | |
def self.verify(name, create = true, initial_value=1) | |
name.downcase! |
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
require 'listen' | |
require 'rb-readline' # <-- adding this fixes issues | |
require 'pry' | |
class MyGuard | |
attr_reader :thread | |
def initialize(dir) | |
callback = ->(*args){puts; puts "Got change: #{args.inspect}"} | |
@listener = Listen.to(dir).change(&callback) |
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
# Variable declaration | |
le text = "Hello, Rage!" | |
le number = 2 | |
# Begin block with error handling | |
my poorly drawn code | |
# Conditionals | |
number < 3 seriously? | |
U don't say? |
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
module ApplicationHelper | |
# Display alert box with message or optional block | |
def alert_box(alert_type = :info) | |
haml_tag :div, :class => 'row-fluid' do | |
haml_tag :div, :class => "span9 alert alert-#{alert_type}" do | |
haml_tag :a, '×', :class => 'close', :'data-dismiss' => 'alert' | |
block_given? ? yield : msg | |
end | |
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
# Mass-virtualhosting configuration for Nginx | |
# Sets up virtualhosts automatically, in the following way: | |
# test1.laas.tjs.ee -> /srv/laas/test1 | |
# app.tjs.ee -> /srv/prod/test1 | |
server { | |
# enable one of the following if you're on Linux or FreeBSD | |
listen 80 default deferred; # for Linux | |
# If you have IPv6, you'll likely want to have two separate listeners. |
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
# encoding: utf-8 | |
et: | |
errors: | |
messages: | |
expired: "on aegunud, palun küsi uus" | |
not_found: "ei leitud" | |
already_confirmed: "on juba kinnitatud, proovi sisse logida" | |
not_locked: "ei olnud lukus" | |
not_saved: |
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
run ->(e){ n=e['PATH_INFO'][1..-1]; [200, {'Content-type'=>'text/html'}, ["Hello #{n}!"]] } |
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
#!/bin/sh -e | |
#/ Usage: pow [on|off] | |
#/ Toggle between running Pow (http://pow.cx) and Apache on Mac OS X. | |
# Show Usage | |
function usage { | |
grep '^#/' "$0" | cut -c4- | |
exit 2 | |
} | |
[ -z "$1" -o "$1" = "--help" ] && usage |
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
require 'test_helper' | |
require 'mocha' | |
class MmoTest < ActiveSupport::TestCase | |
# Set up equivalence classes for the tests | |
def setup | |
# Equivalence classes | |
@styles = { | |
"video" => { |