Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♂️

Aaron Cruz mraaroncruz

🏃‍♂️
View GitHub Profile
View staticmatic_rake_deploy
# Part of this borrowed from a jekyll deploy script from the jekyll author.
# This assumes sprockets and juicer which will combine your js modules and yui compress them respectively
BASE = File.dirname(__FILE__)
SRC = "#{BASE}/src"
SITE = "#{BASE}/site"
JSFILE = "javascript.js"
task :default => [:js,:build]
View imagefield_widget.php
<?php
**
* Implementation of hook_form();
*/
// THIS CODE DOESN'T WORK!!! well, i mean, it works, but id doesn't do what it is supposed to do...
function community_form(&$node, $form_state) {
$type = node_get_types('type', $node);
// We need to define form elements for the node's title and body.
$form['title'] = array(
@mraaroncruz
mraaroncruz / gist:959148
Created May 6, 2011
fail running serve
View gist:959148
[serve]$ serve mockups
/usr/local/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/sass_extensions/functions/urls.rb:21:in `<module:Urls>': undefined method `declare' for Sass::Script::Functions:Module (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/sass_extensions/functions/urls.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/sass_extensions/functions.rb:9:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/sass_extensions/functions.rb:5:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/sass_extensions/functions.rb:5:in `<top (required)>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_
@mraaroncruz
mraaroncruz / gist:1312246
Created Oct 25, 2011
ActiveRecord with habtm and owner
View gist:1312246
class Playlist < ActiveRecord::Base
has_and_belongs_to_many :users
belongs_to :owner, class_name: "User", inverse_of: :owned_playlist
def editable_by?(user)
self.owner == user
end
end
class User < ActiveRecord::Base
@mraaroncruz
mraaroncruz / gist:1373838
Created Nov 17, 2011
Sample consular project
View gist:1373838
cd = "cd /Users/aaron/Sites/rails_app &&"
window do
pane do
pane "#{cd} bin/unicorn -p 3000" # I ran bundle install --binstubs
pane "#{cd} tail -f log/development.log"
pane "#{cd} bin/rails console"
end
tab do
run "#{cd} v."
end
@mraaroncruz
mraaroncruz / open_in_vim.scpt
Created Nov 28, 2011
Open in Iterm in vim from finder window script
View open_in_vim.scpt
(*
* Finder Open iTerm Here - v1.0.2 - 4/14/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
tell application "Finder"
@mraaroncruz
mraaroncruz / gist:1885356
Created Feb 22, 2012
TimespanForWorkRelationship
View gist:1885356
class TimespanForWorkRelationship
def initialize(worker, business)
# retrieves all work assignments for relationship
work_assignments = WorkAssignment.for(worker, business)
@months = create_related_months_for(work_assignments)
end
def create_related_months_for(work_assignments)
# logic to pull months out of workspans
end
@mraaroncruz
mraaroncruz / gist:1963044
Created Mar 3, 2012
fuck you you fucking fuck
View gist:1963044
cache: [GET /products/black_dress] miss
cache: [GET /products/green_dress] miss
cache: [GET /products/nutha_dress] miss
cache: [GET /products/purple_dress] miss
cache: [GET /products/wedding_dress] miss
cache: [GET /blog/2012/02/lovin-weddings] miss
cache: [GET /judge112233.php] miss
cache: [HEAD /] miss
cache: [GET /] miss
cache: [GET /proxyheader.php] miss
@mraaroncruz
mraaroncruz / index.html.slim
Created May 19, 2012
Data attribute helper for slim templating
View index.html.slim
.posts*data(id: post.id, url: post.permalink)
| ...
#=> <div class="post" data-id="123" data-url="/posts/kitten-tossing-banned-in-west-virginia" >...</div>
@mraaroncruz
mraaroncruz / nginx.conf
Created May 23, 2012
No SSL redirects with Spree
View nginx.conf
server {
server_name example.com;
listen 80;
root /var/www/my_app/public;
passenger_enabled on;
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}