This file contains hidden or 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 humanize secs | |
| [[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].inject([]){ |s, (count, name)| | |
| if secs > 0 | |
| secs, n = secs.divmod(count) | |
| s.unshift "#{n.to_i} #{name}" | |
| end | |
| s | |
| }.join(' ') | |
| end |
This file contains hidden or 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
| for a t-shirt? yeah right... ;) |
This file contains hidden or 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
| /************************************* | |
| load libraries | |
| *************************************/ | |
| #include <iostream> | |
| #include <cstdlib> | |
| #include <ctime> | |
| #include <fstream> | |
| using namespace std; | |
| /************************************* | |
| initialize functions |
This file contains hidden or 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
| <% | |
| '//##Misc Methods | |
| '//------------- | |
| '//####################################### | |
| sub view(string) '//process string and add delimeter | |
| response.write(string) & ";" | |
| end sub |
This file contains hidden or 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
| /* | |
| 1) What are all the payplans that exist in GoReg that are associated with all the | |
| various Blast products (i.e. clubblast, clubblast_scholastic, ...) | |
| - break total down by product | |
| - How many invoices exist in total that include one of these payplans? | |
| Identify payplans that do not have a corresponding invoice (i.e. never used) | |
| */ | |
| SELECT PAY_PLAN.*, AFFILIATE.name As aff_name, PRODUCT.*, |
This file contains hidden or 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
| Call Ask() | |
| Sub Ask() | |
| Dim intDoIt | |
| Dim WSHShell | |
| Set WSHShell = WScript.CreateObject("WScript.Shell") | |
| strPage = InputBox("Enter Domain you wish to Grab","GRAB TOOL 1.2 - by Chris Sanz", "http://") | |
| strPage = strPage | |
| if strPage = "" then |
This file contains hidden or 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 sampledb | |
| switched to db sampledb | |
| > a = {"name" : "chris"}; | |
| {"name" : "chris"} | |
| > b = {"name" : "jenn"}; | |
| {"name" : "jenn"} | |
| > db.users.save(a) | |
| > db.users.save(b); | |
| > db.users.find(); | |
| {"_id" : ObjectId( "4d2a3decdf59a32a1973e8d3") , "name" : "chris"} |
This file contains hidden or 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 file: https://github.com/ry/node/blob/6eca6b1ec05c5b386121a992dc7f6502f001f052/doc/api/http.markdown | |
| issue: you are getting the body length, but you are not passing it anywhere. | |
| var body = 'hello world'; | |
| response.writeHead(200, { | |
| 'Content-Length': body.length, | |
| 'Content-Type': 'text/plain' }); |
This file contains hidden or 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
| #!/bin/bash | |
| #author: csanz | |
| pid=`ps afx | grep "node" | grep "$1" | grep "app.js" | awk '{print $1'}` | |
| if [ -z $pid ] | |
| then | |
| echo "the node instance doesn't exists" | |
| fi | |
| if [ "$pid" != '' ] | |
| then |
This file contains hidden or 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
| db.users.group({ key: { name:true }, | |
| cond: { "created_at"}, | |
| initial: { count: 0 }, | |
| reduce: function(obj,out) { out.count ++ ; }}); | |
| /* | |
| Note1: make sure you put the initial declaration above reduce or else the count variable never gets set | |
| Note2: group() can't handle more than 10000 unique keys, so for large dbs you are better off using straight up map reduce. | |
| */ |