This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// scroll to animation | |
// example usage: $('.scroll_to_here').scrollTo(); | |
jQuery.fn.scrollTo = function(speed) { | |
if(speed === undefined ){ | |
speed = 'slow'; | |
} | |
$('html,body').animate({scrollTop: this.offset().top},speed); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clears and restores a field's default value | |
// example usage (js): $('input.has_default').hasDefaultValue(); | |
// example usage (html): <input class="has_default" default="This is displayed by default" type="text"/> | |
jQuery.fn.hasDefaultValue = function() { | |
function supports_input_placeholder() { | |
var i = document.createElement('input'); | |
return 'placeholder' in i; | |
} | |
if(!supports_input_placeholder()){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html | |
$.extend({ | |
getUrlVars: function(){ | |
var vars = [], hash; | |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); | |
for(var i = 0; i < hashes.length; i++) | |
{ | |
hash = hashes[i].split('='); | |
vars.push(hash[0]); | |
vars[hash[0]] = hash[1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Simple AJAX Polling jQuery Plugin | |
// example usage: | |
/* $.ajaxPoll({ | |
url: "/path", | |
type: "GET", | |
interval: 250, | |
maxAttempts: 25, | |
successCondition: function(result) { | |
return result != "processing"; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# monkey-patching SQLServerAdapter to support SQL Server 2005-style pagination | |
# inspired by | |
# - http://alexle.net/archives/tag/mislav-will_paginate-sqlserver-2005 | |
# - http://www.sqlservercentral.com/articles/T-SQL/66030/ | |
# - http://stackoverflow.com/questions/4871523/sql-server-2008-r2-pagination/4871591#4871591 | |
# - https://gist.github.com/335683 | |
# place the following at the bottom of environment.rb: | |
# require "#{RAILS_ROOT}/lib/monkey_patch_sql2005_limit.rb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Novel.tmTheme", | |
"font_size": 12, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"rulers": [80], | |
"font_face": "Inconsolata", | |
"word_wrap": true, | |
"wrap_width":80 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RoR/Padrino | |
log/**/* | |
api/log/**/* | |
tmp/**/* | |
api/tmp/**/* | |
bin/* | |
vendor/gems/* | |
!vendor/gems/cache/ | |
.sass-cache/* | |
*.sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background-color: #C5CCD6; /* Background color */ | |
color: #222; /* Foreground color used for text */ | |
font-family: Helvetica; | |
font-size: 14px; | |
margin: 0; /* Amount of negative space around the outside of the body */ | |
padding: 0; /* Amount of negative space around the inside of the body */ | |
-webkit-user-select: none; | |
overflow-x: hidden; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'cloudfiles' | |
cf = CloudFiles::Connection.new(:username => "", :api_key => "") | |
`mysqldump -u root --password=password --all-databases > /home/deploy/backup.sql` | |
file = File.new("/home/deploy/backup.sql") | |
if file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'cloudfiles' | |
require 'sqlite3' | |
cf = CloudFiles::Connection.new(:username => "", :api_key => "") | |
original = = SQLite3::Database.new('/var/www/project/current/db/original.db') | |
backup = SQLite3::Database.new('/home/deploy/backup.sqlite3') | |
backup_process = SQLite3::Backup.new(backup, 'main', original, 'main') |
OlderNewer