Skip to content

Instantly share code, notes, and snippets.

View fabioyamate's full-sized avatar

Fabio Yamate fabioyamate

View GitHub Profile
require 'grammar_wirth'
require 'pp'
NONTERMINAL = /[a-zA-Z][a-zA-Z_]*/
TERMINAL = /".+"/
RULES = /.*\./
RULE = /(?:([a-zA-Z][a-zA-Z_]*)\s*=)?\s*(.+\.)\n?/
TOKENS = {
"(" => "LPAR",
# Code based from Whenever::CommandLine removing the 'exit' calls and
# adding some helper methods like 'registerd?' and 'remove'
#
# Allows passing a string instead of a file as default.
#
# job = <<-JOB
# set :environment, Rails.env
# set :output, '/path/to/log'
#
# every #{frequency}, :at => '#{time}' do
@fabioyamate
fabioyamate / nokogiri
Created June 18, 2010 02:56
nokogiri installation from libxml2 and libxslt macosx
# using rvm with ruby-1.8.7-p249
# latest version 2.7.7 2010-06-17
brew install libxml2
# installing libxslt from source code
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install
require 'rake/clean'
HAML = FileList['**/*.haml']
LESS = FileList['**/*.less']
COFFEE = FileList['**/*.coffee']
HTML = HAML.ext('html')
CSS = LESS.ext('css')
JS = COFFEE.ext('js')
# this shows how to use the update functionality for a single feed with feedzirra
require 'rubygems'
require 'feedzirra'
# I'm using Atom here, but it could be anything. You don't need to know ahead of time.
# It will parse out to the correct format when it updates.
feed_to_update = Feedzirra::Parser::Atom.new
feed_to_udpate.feed_url = some_stored_feed_url
feed_to_update.etag = some_stored_feed_etag
feed_to_update.last_modified = some_stored_feed_last_modified
@fabioyamate
fabioyamate / schedule.rb
Created November 11, 2010 05:35
Whenever schedule config using RVM
# Using Whenever + RVM
#
# - http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production
# - Add .rvmrc to you project folder
#
set :output, "#{ENV['HOME']}/log/cron_log.log"
set :job_template, "/bin/bash -l -c ':job'"
every 15.minutes do
@fabioyamate
fabioyamate / curb_ubuntu.txt
Created November 11, 2010 12:50
installing curb on ubuntu 10.04
# installing curb gem on Ubuntu require libcurl
sudo apt-get install libcurl3-dev
Or new version, but it conflicts if some libraries.
sudo apt-get install libcurl4-dev
(some other packages libcurl4-openssl-dev libcurl4-gnutls-dev)
gem install curb
@fabioyamate
fabioyamate / .bash_profile
Created March 2, 2011 01:58
git and bash completion
# bash-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
rvm_status() {
rvm_info=$(~/.rvm/bin/rvm-prompt)
if [ -n "$rvm_info" ]; then
echo "($rvm_info)"
fi
@fabioyamate
fabioyamate / _README.md
Created May 25, 2011 12:53 — forked from kneath/_README.md
Intelligent asset bundling for Rails (GitHub's asset bundling)

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
@fabioyamate
fabioyamate / jquery.plugin.coffee
Created August 24, 2011 12:10
CoffeeScript snippet for jQuery plugin
(($) ->
# some code here
)(jQuery)
#= Outputs
#
# (function($) {
# ...
# })(jQuery)