Skip to content

Instantly share code, notes, and snippets.

@stammy
stammy / db.rake
Created May 25, 2009 20:59 — forked from evizitei/db.rake
namespace :db do
desc "abort rake if using bad memory techniques"
task :safety_migrate => :environment do
path = "#{RAILS_ROOT}/db/migrate/"
migration_directory = Dir.new(path)
proceed = true
migration_directory.each do |file|
if file != "." and file != ".."
migration = File.open("#{path}#{file}")
text = migration.read
@stammy
stammy / .bashrc
Created August 17, 2009 22:44 — forked from justintv/.bashrc
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
# ~/code/web:master$ git checkout beta_directory
# Switched to branch "beta_directory"
@stammy
stammy / url_dsl.rb
Created December 14, 2009 19:37 — forked from defunkt/url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json
@danielbru
@dougaitken
@theiBlog
@mike_wilt
@duncanfreeman
@sanjay
@Michaelmontano
@GoKTGo
@colinake
@lessallan
@stammy
stammy / food sites people linked me to on twitter
Created January 5, 2010 04:07
food sites people linked me to on twitter
http://twitter.com/Stammy/status/7389918542
http://cooktobang.com/
http://www.cookingforengineers.com/
http://www.bbc.co.uk/food
http://www.ehow.com/how_5800287_quit-eating-junk-food.html
http://www.betterthancereal.com/index.html
http://www.nursingschoolsearch.com/blog/2008/07/100-food-blogs-to-inspire-your-healthy-eating/
http://justbento.com/
http://justhungry.com/
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
service :notifo do |data, payload|
subscribe_url = URI.parse('https://api.notifo.com/v1/subscribe_user')
data['subscribers'].gsub(/\s/, '').split(',').each do |subscriber|
req = Net::HTTP::Post.new(subscribe_url.path)
req.basic_auth('github', secrets['notifo']['apikey'])
req.set_form_data('username' => subscriber)
net = Net::HTTP.new(subscribe_url.host, 443)
net.use_ssl = true
net.verify_mode = OpenSSL::SSL::VERIFY_NONE
@stammy
stammy / WP-Notifo-notifo_message.php
Created June 16, 2010 07:42
WP-Notifo notifo_message()
<?php
function notifo_message($title,$msg,$uri = false,$to = false)
{
$notifo_pass = get_option('notifo_api_key');
$notifo_user = get_option('notifo_username');
$data = array('label' => get_bloginfo('name'), 'title' => $title, 'msg' => $msg);
if($uri)
{
@stammy
stammy / Notifo JS example: Send message to user from their own user account.js
Created June 16, 2010 07:17
Notifo JS example: Send message to user from their own user account
function sendNotifo(msg,title,uri,label) {
var https = new XMLHttpRequest();
var auth = "Basic " + Base64.encode(localStorage.notifo_username+':'+localStorage.notifo_apisecret);
var push = 'to=' + encodeURIComponent(localStorage.notifo_username) + '&msg=' + encodeURIComponent(msg) + '&uri=' + encodeURIComponent(uri) + '&label=' + encodeURIComponent(label)+ '&title=' + encodeURIComponent(title);
https.open('POST', 'https://api.notifo.com/v1/send_notification', true);
https.setRequestHeader('Authorization', auth);
https.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
https.send(push);
}
.box-gradient {
background-image: -moz-linear-gradient(top, #444444, #999999);
background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #444444),color-stop(1, #999999));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444', endColorstr='#999999');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444', endColorstr='#999999')";
}
.ff2 .box-gradient, .ff3 .box-gradient, .opera .box-gradient {
background-image: url("../images/gradient.svg");
}