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
// This is the library that'll handle all of our input tracking and job dispatching | |
var nodeio = require('node.io'); | |
// The base_url is the site you want to crawl. | |
// Links is an array of all the links seen as <a> tags, but not yet scraped. | |
// crawled_links is the array of all the pages already scraped. | |
var base_url = 'http://reddit.com', | |
links = [base_url], | |
crawled_links = []; |
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
/* | |
* In Response to: http://tampa.craigslist.org/hil/cpg/2630542650.html | |
* | |
*/ | |
var Applicant = function(args){ | |
return { | |
'name': args.name || 'Jos Shmo', | |
'skills': args.skills || {'Not': 0, 'The': 1, 'Right': 0, 'Skills': 1}, | |
'address': args.address || {'street': '123 Spaghetti Code Drive', 'city': 'BadCodersVille', 'state': 'CA'}, |
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 | |
echo "Hello Tumblr." | |
?> |
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 makeCSV(csvValues: List[String]) = { | |
csvValues.map(s => "\""+s.replace("\"", "\\\"").replace(",", "\\,")+"\"").mkString(",") + "\n"; | |
} | |
val csv = List( | |
List("a", "b", "c", "d"), | |
List("e", "f", "g", "h"), | |
List("i", "j", "k", "l") | |
); |
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
/* | |
METHOD route controller | |
GET /index main | |
GET /users users.getAll | |
POST /users users.create | |
GET /users/:id users.getOne | |
PUT /users/:id users.update |
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
{ | |
"name": "Example: GET users search", | |
"documentation": "*Markdown*?", | |
"createDate": "2013-05-24 10:40:15-6", | |
"request": { | |
"method": "GET", | |
"url": "https://api.example.com/v1/users", | |
"parameters": "q=(name:Tester McT)&oauth=X123V456", | |
"body": null, | |
"headers": [ |
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: var myPassword = makePWD(10); | |
function makePWD(len){ | |
// Characters to include in the generator | |
var vars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-_+=~<>;"; | |
var pwd = ''; | |
for(var i=0; i < len; i++){ | |
var idx = Math.floor(Math.random()*vars.length-1); | |
pwd += vars.substring(idx,idx+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
(function () { | |
function JSON2CSV(objArray) { | |
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray; | |
var str = ''; | |
var line = ''; | |
var head = array[0]; | |
for (var index in array[0]) { | |
var value = index + ""; | |
line += '"' + value.replace(/"/g, '""') + '",'; | |
} |
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
nginx: | |
image: myclient/nginx | |
environment: | |
- HOSTHOST=UBUNTU | |
- PROXY_PORT=8069 | |
links: | |
- myservice:myservice | |
ports: | |
- "80:80" | |
- "443:443" |
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
// These two resources helped me out: | |
// http://www.webdeveasy.com/interceptors-in-angularjs-and-useful-examples/ | |
// https://code.angularjs.org/1.4.0/docs/api/ng/service/$q | |
module.factory('httpCacher', ['localStorageService', '$q', '$timeout', '$injector', function(localStorageService, $q, $timeout, $injector) { | |
var cachePrefix = 'ng_http_cache_'; | |
var cacheExpire = 1000 * 60 * 60 * 8; // 8 Hour Expirey | |
// http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ |