Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am rachid on github.
* I am rachidq (https://keybase.io/rachidq) on keybase.
* I have a public key ASCFlAq_Lyk-_j8IGpqP9LsdaobP6BsV4D_3hGjc5QkGtAo
To claim this, I am signing this object:
defp from_model(resource) when is_map(resource) do
resource.__struct__
|> extract
end
defp from_model(resource) do
resource
|> extract
end
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'vim-scripts/renamer.vim'
" Git integration
unbind %
bind \ split-window -h
bind - split-window -v
set -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-select-window on
set -g default-terminal "screen-256color"
set -s escape-time 0
set -g renumber-windows on
@rachid
rachid / calorie_cijfer.rb
Created December 13, 2011 08:50
Product Scraper for caloriecijfer.nl
require 'open-uri'
require 'nokogiri'
USER_AGENTS = [
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3',
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)',
'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3',
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4',
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.2) Gecko/20100323 Namoroka/3.6.2',
# in the rails default Model
class Student < ActiveRecord::Base
default_scope :order => 'lastname ASC'
end
#or in an active admin DSL model
ActiveAdmin.register Student do
scope :all, :default => true do |students|
@rachid
rachid / simple-capistrano-file
Created December 6, 2010 14:18
simple-capistrano-file
# install rails3 with passenger gem
require 'bundler/capistrano'
# first setup your user on your vps, adjust the recipe and do the following commands
# cap deploy:setup
# cap deploy:cold
# cap deploy
set :application, "app-name" #will be used to for you git repository appname
@rachid
rachid / gist:477561
Created July 15, 2010 21:32
deploy.rb.macos
# use the ubuntu machine gem
# tested with MacOS should probably also work fine with unix based machines
require 'capistrano/ext/ubuntu-machine'
# #######################################
# HOSTING PROVIDER CONFIGURATION
# Those tasks have been tested with severa hosting providers
# and sometimes tasks are specific to those providers
@rachid
rachid / deploy.rb
Created February 23, 2010 09:58
deploy.rb.windows
# This recipe works for Windows users
# use the ubuntu machine gem
require 'capistrano/ext/ubuntu-machine'
# #######################################
# HOSTING PROVIDER CONFIGURATION
# Those tasks have been tested with severa hosting providers
# and sometimes tasks are specific to those providers
set :hosting_provider, "slicehost" # currently supported : ovh-rps, ovh-dedie, slicehost