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
source "https://rubygems.org" | |
gem "minitest" | |
gem "rspec" |
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
require 'test/unit' | |
require 'rubygems' | |
require 'shoulda' | |
require 'factory_girl' | |
require 'dm-core' | |
require 'dm-validations' # Needed for save! | |
class User | |
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
--- kcthread.cc.orig 2010-04-01 22:59:17.000000000 -0400 | |
+++ kcthread.cc 2010-04-01 23:04:41.000000000 -0400 | |
@@ -178,12 +178,12 @@ Mutex::Mutex(Type type) { | |
break; | |
} | |
case ERRORCHECK: { | |
- if (::pthread_mutexattr_settype(&attr, ::PTHREAD_MUTEX_ERRORCHECK) != 0) | |
+ if (::pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK) != 0) | |
throw std::runtime_error("pthread_mutexattr_settype"); | |
break; |
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 Food | |
def self.included(model) | |
model.property :id, Serial | |
model.property :price, Integer, :min => 0 # builtin validation works just fine | |
model.property :calories, Integer, :min => 0 | |
model.before(:valid?, :custom_validation) | |
end | |
def custom_validation |
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 Sinatra | |
class Base | |
def call!(env) | |
@env = env | |
@request = Request.new(env) | |
@response = Response.new | |
@params = indifferent_params(@request.params) | |
force_encoding(@params) |
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
register({ | |
name: 'moodle.domain.com', | |
url: 'http://moodle.domain.com/', | |
icon: 'http://moodle.domain.com/theme/mytheme/favicon.ico', | |
domains: [ 'moodle.domain.com' ], | |
sessionCookieNames: [ 'MoodleSession', 'MoodleSessionTest' ], | |
identifyUser: function() { | |
var site = this.httpGet('http://moodle.domain.com/user/view.php'); | |
this.userName = site.body.querySelector('div.logininfo a').text; |
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
# To just pull changes from Github, forcing Git to use your local changes for any conflicts: | |
git pull --strategy=ours origin master | |
# To completely update each of your Git repositories in one command (run this inside each repository): | |
git add . && git commit -m "Updating to current working version" && git pull --strategy=ours origin master && git push origin master |
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
*.log |
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
require 'rubygems' | |
require 'haml' | |
require 'sinatra' | |
require 'sinatra/flash' | |
require 'file_uploader' | |
enable :sessions | |
get '/' do | |
haml :index |
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
require 'goliath' | |
class Hello < Goliath::API | |
# default to JSON output, allow Yaml as secondary | |
use Goliath::Rack::Render, ['json', 'yaml'] | |
def response(env) | |
[200, {}, "Hello World"] | |
end | |
end |
OlderNewer