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
// Universal mongodb reduce function for complex objects | |
// | |
// Example: | |
// | |
// emit({ total_views: 3, page_type: {home: 1, product: 2}, site_id: [1] }) | |
// emit({total_views: 5, page_type: {home: 1, collection: 4}, site_id: [2]}) | |
// | |
// -> reduce | |
// | |
// { total_views: 8, page_type: { home: 2, product: 2, collection: 4 }, site_id: [1,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
<?php | |
/** | |
* The code below shows example usage of the SecureHash class for | |
* encrypting a password. In terms of additional usage, you should | |
* store the resulting encrypted password in addition to the salt | |
* in your db. | |
*/ | |
// load the class | |
$secure = new SecureHash(); |
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
angular.module('itemServices', ['ngResource']) | |
.factory('Item', ['$resource', | |
function ($resource) { | |
return $resource('items/:id', | |
{id: '@id'}, | |
{ | |
query: { | |
isArray: true, | |
method: 'GET', | |
params: {}, |
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
// npm install bcrypt | |
var bcrypt = require('bcrypt'); | |
var password = process.argv[2]; | |
bcrypt.genSalt(function(err, salt) { | |
if (err) { | |
console.log(err); | |
} | |
console.log('salt: ' + salt + ' (length: ' + salt.length + ')'); |
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 scapy.all import * | |
print sr1(IP(dst="4.2.2.1")/ICMP()).summary() |
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
<? | |
$launchkey->ping(); | |
?> |
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
local coroutine = require "coroutine" | |
local io = require "io" | |
local math = require "math" | |
local nmap = require "nmap" | |
local shortport = require "shortport" | |
local sslcert = require "sslcert" | |
local stdnse = require "stdnse" | |
local string = require "string" | |
local table = require "table" | |
local tls = require "tls" |
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
Backbone.Collection.prototype.update = function(col_in){ | |
var that = this, | |
ids = []; | |
var cur_ids = that.pluck('id'), | |
new_ids = _(col_in).pluck('id'), | |
to_remove = _(cur_ids).difference(new_ids); | |
this.remove(to_remove); |
OlderNewer