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
//Mock API data | |
let apiData = { | |
"coord": { | |
"lon": 115.8333, | |
"lat": -31.9333 | |
}, | |
"weather": [{ | |
"id": 802, | |
"main": "Clouds", | |
"description": "scattered clouds", |
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
void GiganticHackToFixStupidMonoHttpListenerBug(HttpListenerRequest request) { | |
if (NHyperWeb.RunningUnderMono) { | |
//On some versions of mono url gets decoded twice, fix that and set the URL back with Reflection | |
//This is effectively replicating logic in this fix: https://github.com/mono/mono/compare/68c6eed76919...4a8ffc802392 | |
var originalUrl = request.Url; | |
//Detect incorrect decode | |
if (originalUrl.PathAndQuery != request.RawUrl) { | |
try { | |
var urlBase = new Uri(string.Format("{0}://{1}:{2}", originalUrl.Scheme, originalUrl.Host, originalUrl.Port)); | |
var url = new Uri(urlBase, request.RawUrl, true); |
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
package main | |
import ( | |
"fmt" | |
) | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. | |
Fetch(url string) (body string, urls []string, err 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
- pkgs2install=\"$METAPKG_NAME=$METAPKG_VERSION `apt-cache showpkg $METAPKG_NAME | awk 'BEGIN { depends=0 } $1 ~ /:$/ { depends=0 } depends == 1 { print } $1 == \"Dependencies:\" { depends=1} ' | grep ^$METAPKG_VERSION | sed -e 's/^[^[:space:]]* - //' -e 's/) /\\n/g' | awk 'BEGIN { ORS=\" \" } $0 == \"\" { next } $3 != \"(null)\" { print $1 \"=\" $3 }'`\" |
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
//Problem: In node.js, one must pool redis db connections, otherwise they die | |
//Solution: Use generic-pool | |
pool = poolModule.Pool({ | |
name: 'redis', | |
create: function (callback) { | |
var redisClient = redis.createClient(); | |
callback(null, redisClient); | |
}, | |
destroy : function (client) { |
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
## C++ blog posts | |
- http://www.somethingorothersoft.com/2009/12/11/shouldnt-raii-should-be-rdid/ | |
- http://www.somethingorothersoft.com/2010/02/01/double-dispatch-without-rtti/ | |
- http://www.somethingorothersoft.com/2010/02/02/double-dispatch-rtti-vs-pure-vtable/ | |
## C++ StackOverflow posts (sorted by epicness) | |
- http://stackoverflow.com/questions/2061593/why-do-c-languages-require-parens-around-a-simple-condition-in-an-if-statement | |
- http://stackoverflow.com/questions/2017623/forward-unbreakable-accessor-class-templates-c/2017783#2017783 |
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
info: Creating snapshot 0.0.0-14 | |
info: Updating app runheat | |
info: Activating snapshot 0.0.0-14 for runheat | |
info: Stopping app runheat | |
info: App runheat is now stopped | |
info: Starting app runheat | |
error: Error running command deploy | |
error: Nodejitsu Error (500): Internal Server Error | |
error: There was an error while attempting to deploy your application. | |
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
_controllerArray = [NSMutableArray arrayWithObjects: | |
[[SortedRoomsController alloc] init], | |
[[SearchableRoomsController alloc] init], | |
nil | |
]; | |
//Unit test | |
/*This particular one is a manual one*/ | |
- (void) controller_should_work | |
{ |
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
/* | |
* -*- Engage Auth Widget -*- | |
* Copyright (c) 2011, Janrain, Inc. All rights reserved. | |
* Version: 2012.14_rc9 | |
* */ | |
if (!Array.prototype.indexOf) Array.prototype.indexOf = function (P) { | |
for (var R in this) if (this[R] === P) return parseInt(R) | |
}; | |
if (!Array.prototype.map) Array.prototype.map = function (P, R) { | |
if (typeof this != "function" || this === null) throw new TypeError; |
NewerOlder