Navigation Menu

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
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 / .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)
From d6baaf8ed0f0cddbd311210042f3b91fa800b737 Mon Sep 17 00:00:00 2001
From: Fabio Yamate <fabio.yamate@plataformatec.com.br>
Date: Mon, 3 Oct 2011 01:18:07 -0300
Subject: [PATCH] Add checkboxes collection bootstrap.
---
lib/simple_form/action_view_extensions/builder.rb | 7 ++++---
lib/simple_form/components/labels.rb | 4 ++--
lib/simple_form/inputs/boolean_input.rb | 8 ++++++--
3 files changed, 12 insertions(+), 7 deletions(-)
@fabioyamate
fabioyamate / mode.rb
Created November 23, 2011 12:37
Paperclip - remove attachment
class Model < ActiveRecord::Base
has_attached_file :icon
has_removable_file :icon
end