Skip to content

Instantly share code, notes, and snippets.

@amit
amit / backup.rake
Last active August 29, 2015 14:13 — forked from abhishek77in/backup.rake
namespace :db do desc "Backup database to AWS-S3"
task :backup => [:environment] do
datestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S")
backup_filename = "#{Rails.root.basename}-#{datestamp}.sql"
db_config = ActiveRecord::Base.configurations[Rails.env]
# process backup
`mysqldump -u #{db_config['username']} -p#{db_config['password']} -i -c -q #{db_config['database']} > tmp/#{backup_filename}`
`gzip -9 tmp/#{backup_filename}`
puts "Created backup: #{backup_filename}"
@amit
amit / adremover.user.js
Last active December 16, 2015 02:49
Ad remover
// ==UserScript==
// @name HQLive ad remover
// @description Version 1.2 - Remove annoying chat and ad iframes from hqlive
// @namespace http://hqlive.net/
// @include http://*hqlive.net/*
// @include http://*cricket-365.tv/*
// @include http://*cricvid.com/*
// @include http://*cricvip.com/*
// @include http://*live365.tv/*
कहाँ से तू आती है
कहाँ को तू जाती है
सपनों को सजाती है
अपनों को ले जाती है
बाग़ों में जब बहती है
कानों में कुछ कहती है
आती है नज़र नहीं
साँसों में पर रहती है
हवा है पवन है
वायु है , पुरवाई है
@amit
amit / patchfile.txt
Created January 13, 2012 20:00
weekly-class-schedule support for upcoming classes.
--git a/css/wcs_style.css b/css/wcs_style.css
index ad4c85f..ec2d248 100644
--- a/css/wcs_style.css
+++ b/css/wcs_style.css
@@ -1,6 +1,21 @@
#content .wcs-schedule-table {
font-size: 12px;
}
+
+#content .wcs-upcoming-schedule-table {
@amit
amit / Quic bookmarklet.js
Created March 22, 2011 23:47
Expanded Quix bookmarklet
javascript:Quix();function Quix() {
var e=encodeURIComponent; // shortcut for the function name
var t=window.getSelection ? window.getSelection():
(document.getSelection? document.getSelection(): (document.selection ? document.selection.createRange().text:'')); // Get selection or empty string
var c=window.prompt('Quix: Type `help` for a list of commands:');
if(t!='') {
if(c) {
c+=' '+t; // append selection to typed text
}
else {
@amit
amit / gist:381040
Created April 27, 2010 17:35
bookmarklet jquery insert
javascript:function loadScript(u) {
var s = document.createElement('script');
s.setAttribute('src', u);
s.onreadystatechange= function () {
bmhelper();
};
s.onload = bmhelper;
document.getElementsByTagName('body')[0].appendChild(s);}
loadScript('http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');
function bmhelper(){
diff --git a/git-wiki.rb b/git-wiki.rb
index 9f36624..337a5f6 100755
--- a/git-wiki.rb
+++ b/git-wiki.rb
@@ -20,7 +20,7 @@ end
get '/:page/append' do
@page = Page.new(params[:page])
- @page.body = @page.raw_body + "\n\n" + params[:text]
+ @page.append params[:text]
# = Icebox : Caching for HTTParty
#
# First stab at implementing caching for HTTParty (http://github.com/jnunemaker/httparty/)
# Modeled after Martyn Loughran's APICache (http://github.com/newbamboo/api_cache/)
#
# = Usage
# 1. <tt>include Icebox</tt> in YourPartyAnimalClass
# 2. Use <tt>YourPartyAnimalClass.get_cached()</tt> instead of simple <tt>get()</tt>
require 'logger'
require 'rubygems'
require 'mash'
require 'httparty'
class CharityNavigator
include HTTParty
format :xml
base_uri "www.charitynavigator.org/feeds/search4"
def initialize(appid)