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 'aws/s3' | |
require 'heroku' | |
require 'heroku/command' | |
require 'heroku/command/auth' | |
require 'heroku/command/pgbackups' | |
task :cron do | |
class Heroku::Auth | |
def self.client | |
Heroku::Client.new ENV['heroku_login'], ENV['heroku_passwd'] |
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
[HttpPost] | |
public ActionResult Create(int id, Projekt model) | |
{ | |
var p = db.Get<Projekt>(id); | |
if (p.Typ1Validering) | |
if (string.IsNullOrEmpty(model.Field)) | |
ModelState.AddModelError("Field", "Fältet får inte vara tomt"); | |
if (ModelState.IsValid) | |
{ |
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 'rack' | |
require 'json' | |
require 'torquebox-messaging' | |
class EventStream | |
def self.call(env) | |
path = Rack::Utils.unescape env["PATH_INFO"] | |
[200, { | |
'Content-Type' => 'text/event-stream', | |
'X-Accel-Buffering' => 'no', |
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
$ jruby -e "require 'uglifier'; Uglifier.compile File.read 'jquery-1.7.1.js'" | |
java(25487,0x10f18a000) malloc: *** error for object 0x7f9604a05300: pointer being freed was not allocated | |
*** set a breakpoint in malloc_error_break to debug | |
Abort trap: 6 |
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
user www-data; | |
pid /var/run/nginx.pid; | |
worker_processes 1; | |
events { | |
worker_connections 1024; # increase if you have lots of clients | |
accept_mutex off; # "on" if nginx worker_processes > 1 | |
use epoll; # enable for Linux 2.6+ | |
} |
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
cloudpostgres (monitor)$ git push | |
Counting objects: 33, done. | |
Delta compression using up to 4 threads. | |
Compressing objects: 100% (18/18), done. | |
Writing objects: 100% (18/18), 2.26 KiB, done. | |
Total 18 (delta 13), reused 0 (delta 0) | |
remote: /data/github/current/lib/github/config/resque.rb:27: undefined method `constantize' for "GitHub::Jobs::TransformUserIntoOrg":String (NoMethodError) | |
remote: from /data/github/current/lib/github/config/resque.rb:26:in `each' | |
remote: from /data/github/current/lib/github/config/resque.rb:26 | |
remote: from /data/github/current/lib/rock_queue.rb:9:in `require' |
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 'dm-core' | |
DataMapper.setup(:default, 'in_memory::') | |
class A | |
include DataMapper::Resource | |
property :id, Serial | |
property :jada, String | |
has n, :bs | |
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
require 'eventmachine' | |
require 'em-http-request' | |
# Reference: | |
# https://github.com/igrigorik/em-http-request/wiki/Parallel-Requests | |
# http://rdoc.info/github/eventmachine/eventmachine/master/EventMachine/Iterator | |
urls = ['http://www.google.com', 'http://www.cloudamqp.com'] |
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 'rack' | |
gem 'puma' |
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
public static class QuerableExtensions | |
{ | |
public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property, bool asc) | |
{ | |
return ApplyOrder<T>(source, property, asc ? "OrderBy" : "OrderByDescending"); | |
} | |
public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property) | |
{ | |
return ApplyOrder<T>(source, property, "OrderBy"); | |
} |