Skip to content

Instantly share code, notes, and snippets.

View shinypb's full-sized avatar
☀️
I'm just happy to be here.

Mark Christian shinypb

☀️
I'm just happy to be here.
View GitHub Profile
/* Assume that this component exists somewhere: */
twttr.klass('twttr.components.Person', function(name, location) {
this.name = name;
this.location = location;
});
/* A few ideas for the syntax we should use for asyncronous instantiation: */
// 1. Pass variable number of constructor arguments and callback as the last argument
var callback = function(instance) {
# Where "Foobar" is the name I gave my modem under System Preferences > Network
networksetup -connectpppoeservice Foobar
Hi, Dan;
Patrick and I were discussing how to resolve today's incident, which stemmed from the fact that anything with a ".js" file extension is served from Apache, not Rails, in production. We've got an end point that returns a dynamic provide statement with a bunch of exported data. Looking at it, it's really just a vessel for that exported data.
How would you feel about extending Loadrunner to automatically export requests to JSON endpoints?
Here's (roughly) what we have now:
In the HTML of the page, we include the data file like this:
using('/account/bootstrap_data.js');
#!/usr/bin/env bash
chmod -x ~/workspace/twitter/.git/hooks/pre-commit
git commit $@
chmod +x ~/workspace/twitter/.git/hooks/pre-commit
twttr.currentUser.relationshipWith(name, {
success: function(relationship) {
if (canDM) {
that.trigger('dmSuccess', [tweet, that.options.statusAction]);
} else {
error();
}
},
error: error
});
NSDictionary groupItems(NSArray *items) {
int bucket = 0;
NSDictionary *groupedItems = [NSDictionary alloc];
id prevItem;
const kItemTimeDistanceThreshold = 30;
[groupedItems setObject:[NSArray alloc] forKey:bucket];
// I can't remember how to properly iterate in Objective C,
// so let's pretend you can use foreach.
?M
M
.$ D?
:M M
@shinypb
shinypb / gist:988945
Created May 24, 2011 15:42
Rdio Mac app bug report
The Rdio app interferes with normal system sleep. I've seen it happen on two unrelated MacBook Pros.
I initially noticed this problem on my own system while working on an app that intentionally delays
system sleep — I thought I had a bug. However, when I tried to track it down, I found that Rdio was
the culprit. Last night, I saw similar behaviour on my girlfriend's computer when she shut the lid
and immediately opened it up again to do something else. Once she'd re-opened it, Chrome wouldn't
make network connections because the system was in the middle of the sleeping process, and 30 seconds
later, it shut off. Rdio was running.
On the Mac, before the system goes to sleep, it gives every app a chance to delay that sleep for up
function doSomething() {
// this is the main function
};
// Style A - shorter, but names don't directly match when they run, which may be confusing
doSomething.after(function() {
// this runs before doSomething
});
When you first start off trying to solve
a problem, the first solutions you come
up with are very complex, and most people
stop there. But if you keep going, and
live with the problem and peel more
layers of the onion off, you can often
times arrive at some very elegant and
simple solutions. Most people just
don't put in the time or energy to get
there. We believe that customers are