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
//UUID generator | |
function _imgName() { | |
return time() . substr(md5(microtime()), 0, 12); | |
} |
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
// Creates a URL Slug | |
function _url_slug($string) { | |
$string = strtolower(trim($string)); | |
$string = preg_replace('/[^a-z0-9-]/', '-', $string); | |
$string = preg_replace('/-+/', "-", $string); | |
return $string; | |
} | |
// Gets a Unique slug string by checking in the database |
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
// Random Password Generator | |
function _RandomPasswordGenerator() { | |
// Create the meta-password | |
$sMetaPassword = ""; | |
$CONFIG['security']['password_generator'] = array("C" => array('characters' => | |
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'minimum' => 4, | |
'maximum' => 6), "S" => array('characters' => "!@()-_=+?*^&", 'minimum' => 0, | |
'maximum' => 0), "N" => array('characters' => '1234567890', 'minimum' => 2, | |
'maximum' => 2)); |
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
source 'https://rubygems.org' | |
ruby "2.0.0" | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
... |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
window.fbAsyncInit = function () { | |
FB.init({ | |
appId: 'APPID', | |
Status: true, | |
Cookie: true, | |
Xfbml: true | |
}); | |
FB.Event.subscribe('edge.create', function (response) { | |
Alert("Hello World! URL Liked!"); | |
}); |
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
FB.Event.subscribe('edge.create', function(targetUrl) { | |
_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); | |
}); |
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
validates_inclusion_of :birthday, | |
:in => Date.new(1900)..Time.now.years_ago(18).to_date, | |
:message => 'Too young, dude!' |
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
function hideAddressBar() | |
{ | |
if(!window.location.hash) | |
{ | |
if(document.height < window.outerHeight) | |
{ | |
document.body.style.height = (window.outerHeight + 50) + 'px'; | |
} | |
setTimeout( function(){ window.scrollTo(0, 1); }, 50 ); |
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
<IfModule mod_deflate.c> | |
SetOutputFilter DEFLATE | |
<IfModule mod_setenvif.c> | |
# Netscape 4.x has some problems | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
# Netscape 4.06-4.08 have some more problems | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip |
OlderNewer