Skip to content

Instantly share code, notes, and snippets.

View piclez's full-sized avatar

Peter WD piclez

View GitHub Profile
upstream localhost {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name localhost;
# Set the max size for file uploads to 50Mb
client_max_body_size 80M;
r.namespace :admin do |admin|
admin.resources :products
r.resources :product_lines do |product_line|
product_line.resources :products
end
end
module Admin
class Items < Application
# provides :xml, :yaml, :js
def index
@items = Item.all
display @items
end
def show(id)
# lib/color_logger.rb
module Merb
class Logger
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white # 30 = black 31 = red 32 = green 33 = yellow blue 34 = 35 = magenta 36 = cyan 37 = white
Colors = Mash.new({
:fatal => 31,
:error => 31,
:warn => 33,
:info => 38,
class Segment
include DataMapper::Resource
property :id, Serial
property :title, String
has n, :products, :through => Resource
end
class Product
include DataMapper::Resource
property :id, Integer, :serial => true
thor merb:gem:list
Installed local gems:
~ ParseTree-3.0.2
~ RubyInline-3.8.1
~ ZenTest-3.11.0
~ abstract-1.0.0
~ addressable-1.0.4
~ data_objects-0.9.6
~ dm-aggregates-0.9.6
~ dm-core-0.9.6
@piclez
piclez / tmp.rb
Created November 16, 2010 18:25 — forked from vvs/tmp.rb
require 'tempfile'
require 'java' if defined?(JRUBY_VERSION)
require 'test/unit'
require 'fileutils'
class TestTempfilesCleanUp < Test::Unit::TestCase
def setup
@tmpdir = "tmp_#{$$}"
Dir.mkdir @tmpdir rescue nil
@piclez
piclez / queue.js
Created November 16, 2010 18:25 — forked from dominictarr/queue.js
var sys = require('sys'),
exec = require('child_process').exec;
// fs = require('fs');
// ecsv = require('ecsv')
function Queue () {
var waiting = [];
this.max = -1;
this.current = 0;
//run checks if we're under the max processors, and runs if there is room.
@piclez
piclez / gist:f5e32ce6c060e2e5152e
Last active August 29, 2015 14:02
Mac commands
find . -name '*.DS_Store' -type f -delete
cd /opt/boxen/rbenv/plugins/ruby-build/ && git pull
@piclez
piclez / .profile
Created November 6, 2015 20:00
.profile
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
alias gst="git status"
alias gpr="git pull --rebase"
alias dev="git checkout develop"