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
Example = {}; | |
Example.button = function(el) { | |
el.onclick = this.click; | |
} | |
Example.button.prototype.click = function() { | |
alert('YOU CLICK DA BUTTON'); | |
} |
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
#import "User.h" | |
@implementation User | |
@synthesize name = _name; | |
@synthesize email = _email; | |
@synthesize device_id = _device_id; | |
+ (User*) current_user { |
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
def cipher(mode, salt, pepper, iv) | |
@cipher = OpenSSL::Cipher::Cipher.new('aes-128-cbc') | |
if mode | |
@cipher.encrypt | |
else | |
@cipher.decrypt | |
end | |
# @cipher.padding=1 | |
key = Digest::SHA1.hexdigest(salt + pepper) |
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
static VALUE | |
ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode) | |
{ | |
EVP_CIPHER_CTX *ctx; | |
unsigned char key[EVP_MAX_KEY_LENGTH], *p_key = NULL; | |
unsigned char iv[EVP_MAX_IV_LENGTH], *p_iv = NULL; | |
VALUE pass, init_v; | |
if(rb_scan_args(argc, argv, "02", &pass, &init_v) > 0){ | |
/* |
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
@key = EzCrypto::Key.with_password "special", "secretzz" | |
info = @key.encrypt("sensitive information") | |
encrypted = Base64.encode64(info) | |
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
var current_date = new Date; | |
// Thu Jun 23 2011 11:35:42 GMT-0700 (PDT) | |
current_date - 3600000 // minus an hour | |
// => 1308850542267 | |
current_date + 3600000 // plus an hour | |
// => "Thu Jun 23 2011 11:35:42 GMT-0700 (PDT)3600000" ARE YOU KIDDING ME!!! | |
current_date - (-3600000) // plus an hour wtfjs |
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 valididate_dependent(select, textarea, hidden) { | |
if (select.val() == 'No' || textarea.val() != "" ) { | |
hidden.val('N/A'); | |
textarea.removeClass('error'); | |
} else { | |
hidden.val(''); | |
textarea.addClass('error'); | |
} | |
} |
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
var kiwi = require('kiwi'), | |
redis = kiwi.require('redis-client'), | |
client = redis.createClient(), | |
sys = require('sys'); | |
client.rpush("rev::revisions", "party", function(err, value) { | |
client.lrange("rev::revisions", 0, 1, function(err, data) { | |
sys.puts( JSON.stringify(data) ) // [{"0":112,"1":97,"2":114,"3":116,"4":121,"length":5}] | |
client.close(); | |
}) |
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
var kiwi = require('kiwi') | |
kiwi.require('express') | |
get('/', function(){ | |
this.redirect('/hello/world') | |
}) | |
get('/hello/world', function(){ | |
return 'Hello World' | |
}) |