Skip to content

Instantly share code, notes, and snippets.

@alkema
alkema / id.css
Last active August 29, 2015 14:13 — forked from andyvanee/id.css
/* id styling has widespread effects */
#site a { padding-left: 10px; }
/* does nothing */
li a { padding-left: 10px; }
/* also does nothing */
.sidebar li:first a { padding-left: 10px; }
drop table pod_markets;
drop table pod_sections;
drop table pods;
drop table feature_pods;
drop table promotion_pods;
drop table getaway_pods;
drop table activity_pods;
drop table gear_pods;
drop table journal_pods;
drop table filter_group_pods;
- cache [@current_market, MarketPod.get_in_shape.name, get_in_shape_pods.max_by(&:updated_at)] do
.module-header
%h3
Get in Shape
%a.button.button-see-all-white{href: products_path}
See All
%ul.clearfix
- if get_in_shape_pods.present?
- pod = get_in_shape_pods[0]
- cache [MarketPod.get_in_shape.name, "small-pod", pod] do
@alkema
alkema / slack.md
Last active August 29, 2015 14:24
Slack > HipChat

Reasons why I think Slack is a better user experience

  • search works far better
  • account switching works really well
  • autocomplete of addressing other users is not buggy in Slack
  • up arrow history
  • proper editing of messages

little things

require 'rubygems'
require 'active_record'
desc 'migrate legacy table to add column'
namespace :document_manager do
namespace :db do
task :migrate do
ActiveRecord::Base.clear_active_connections!
configs = open('config/database.yml') { |f| YAML.load(f) }
ActiveRecord::Base.logger = Logger.new(STDOUT)
#calling view
<%= growl4rails_includes(3000, 5) %>
<%=
periodically_call_remote(
:url => '/foos/loading_statuses.js',
:frequency => '4',
:complete => "request",
:method => 'GET'
)
find . -name "* *"|while read file
do
echo "$file"
mv "$file" "`echo "$file"| awk ' BEGIN {OFS="_"} $1=$1 '`"
done
@alkema
alkema / twat.rb
Created April 6, 2009 21:54 — forked from Aupajo/twat.rb
#!/usr/bin/env ruby
# Find common Twitter friends
# Usage: ./twat.rb user1 user2 ...
lists = ARGV.inject({}) do |hash, username|
page = 0
while !(output = `curl -s http://twitter.com/statuses/friends/#{username}.xml?page=#{page += 1} | grep "<screen_name>"`.gsub(%r{</?screen_name>}, '').split).empty?
hash[username] = ((hash[username] || []) + output).sort
end
hash
@alkema
alkema / seed.rake
Created August 17, 2009 04:37
rails 3 rake db:seed for now
namespace :db do
desc 'Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.'
task :reset => [ 'db:drop', 'db:setup' ]
desc 'Create the database, load the schema, and initialize with the seed data'
task :setup => [ 'db:create', 'db:schema:load', 'db:seed' ]
desc 'Load the seed data from db/seeds.rb'
task :seed => :environment do
seed_file = File.join(Rails.root, 'db', 'seeds.rb')
#!/usr/bin/env ruby
require "cgi"
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => ,
:database => ,
:username => ,
:password => ,
:host =>