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
@shinypb
shinypb / defineClass.js
Created December 9, 2012 04:21
A relatively small, pretty crappy inheritance/class thingy
// Here's the defineClass function
(function() {
function defineClass() {
var kDefineClassMagicValue = 'defineClass_do_not_call_user_provided_constructor';
var args = Array.prototype.slice.apply(arguments);
var className, superClassName, constructor, properties;
className = args.shift();
if (typeof args[0] == 'string') {
superClassName = args.shift();
{
:test_nokogiri =>
{
:text_without_entities => 1.440876,
:text_with_entities => 1.48466
},
:test_nokogiri_new =>
{
:text_without_entities => 1.42785,
:text_with_entities => 1.53331
@shinypb
shinypb / gist:2855218
Created June 1, 2012 21:24
Async Deck loading code
<div id="SidebarTheDeck">
<script type="text/javascript">
(function(id) {
var theDeck = document.createElement('script'); theDeck.type = 'text/javascript'; theDeck.async = true;
theDeck.src = 'http://connect.decknetwork.net/deck' + id + '_js.php?' + (new Date().getTime());
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(theDeck, s);
})("DF");
</script>
</div>
Caused by this code:
NSImage *translucentImage = [[NSImage alloc] initWithSize:[imageRep size]];
NSRect rect = NSMakeRect(0, 0, [image size].width, [image size].height);
[translucentImage lockFocus];
Running on the main thread. WTF.
#0 0x00007fff910a2a4f in CGSFillDRAM8by1 ()
#1 0x00007fff91105fb6 in argb32_mark_constshape ()
#2 0x00007fff911059c3 in argb32_mark ()
cerebus:~ shinyplasticbag$ cat /home/shinyplasticbag/domains/markchristian.org/projects/ideafactory/ideas.txt
Mark at 2007-11-21@14:00:
I like things.
Seanstoppable at 2007-11-21@14:07:
What I Like
A site where you can make a list of things you have owned/rented/tried and, based on the rating you provide, gives you suggestions of other things you like.
Kinda like Amazon reccomendations, except easier to add things you already have.
<!DOCTYPE html>
<html>
<body>
<div id="templates" style="display:none;">
<div id="header" class="template"><!--
<i>{{awesomeGuy}} is awesome</i>
--></div>
<div id="body" class="template"><!--
<i>Hello, {{name}}!</i>
--></div>
@shinypb
shinypb / gist:1424674
Created December 2, 2011 20:13
Nyancat in your Terminal
curl http://markchristian.org/projects/nyancat/nyancat.sh -o ~/bin/nyancat; chmod +x ~/bin/nyancat; ~/bin/nyancat
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
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
});
@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