Skip to content

Instantly share code, notes, and snippets.

View Sophrinix's full-sized avatar

Andrew McElroy Sophrinix

View GitHub Profile
// Twitter Hashtag Ignore
// version 0.3
// 2008-01-25
// Copyright (c) 2009, August Lilleaas
// Released under the MIT license
// http://www.opensource.org/licenses/mit-license.php
//
// ==UserScript==
// @name Twitter Hashtag Ignore
// @namespace http://www.twitter.com/*
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@resistorsoftware
resistorsoftware / DJ
Created June 11, 2011 21:05
Elegant Delayed Job for Shopify
# here comes 1, 2, 200, or even 603 id's
get '/orders/do_it_man/?' do
if ShopifyAPI.credit_left > 0
Delayed::Job.enqueue(Hookah::Pipe.new(current_shop.site, params[:ids])) # <-- regular run, we have some credit...
else
Delayed::Job.enqueue(Hookah::Pipe.new(current_shop.site, params[:ids]), 0, 601.seconds.from_now) # <--- no credit, run later
end
end
module Hookah
@ariera
ariera / README.markdown
Created August 7, 2011 16:23
Nestable, sortable and dragable categories

Nestable, sortable and dragable categories:

In the project I'm working on we wanted to have a Category model which we wanted to be nestable. But we also liked the user to have a draggable interface to manage and rearrange the order of his categories. So we chose awesome_nested_set for the model and jQuery.nestedSortable for the UI.

It took me some time to arrange things to work properly so I wanted to share my work in case it helps anybody.

Before beginning

you might want to take a look at a demo app

  1. go to: http://awesomenestedsortable.heroku.com/groups/
  2. click in show of any group
require 'rspec'
def something
"something"
end
def y_u_no?(expectation, &block)
block.call == expectation
end
@aaronshaf
aaronshaf / es.sh
Created September 3, 2011 03:53
Install ElasticSearch on Ubuntu 11.04
cd ~
sudo apt-get update
sudo apt-get install unzip curl python-software-properties -y
#sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
@yagitoshiro
yagitoshiro / push_notifications.js
Last active August 13, 2016 17:29
apple push notification sample (Titanium Mobile)
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)
@briandoll
briandoll / top_gems.state_of_the_stack.txt
Created September 28, 2011 18:58
Top 50 Ruby Gems in Production : New Relic State of the Stack : Q3 2011
Count Gem
7570 rack
7444 rake
7425 rails
7424 activesupport
7421 bundler
7412 actionpack
7410 actionmailer
7409 activerecord
7397 activeresource
@briandoll
briandoll / top_plugins.state_of_the_stack.txt
Created September 28, 2011 19:00
Top 50 Rails Plugins in Production : New Relic State of the Stack : Q3 2011
Count Plugin
2040 rpm
1534 newrelic_rpm
1268 acts_as_list
1186 paperclip
1130 will_paginate
1068 exception_notification
1026 jrails
1010 restful_authentication
1009 haml
@rolo
rolo / gist:1481128
Created December 15, 2011 13:44
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update