Skip to content

Instantly share code, notes, and snippets.

View clarle's full-sized avatar

Clarence Leung clarle

  • Netflix
  • Los Gatos, CA
  • 14:59 (UTC -07:00)
  • X @clarler
View GitHub Profile
@r3econ
r3econ / gist:9953196
Created April 3, 2014 12:09
Posting JSON file using NSURLSession.
// URL of the endpoint we're going to contact.
NSURL *url = [NSURL URLWithString:@"http://localhost:8080/my.json"];
// Create a simple dictionary with numbers.
NSDictionary *dictionary = @{ @"numbers" : @[@1, @2, @3] };
// Convert the dictionary into JSON data.
NSData *JSONData = [NSJSONSerialization dataWithJSONObject:dictionary
options:0
error:nil];

MDB is unlike most debuggers you've experienced.

It is not a source level debugger like gdb or lldb or even Node's builtin debugger

Generally used for postmortem analysis.

Postmortem is for Production and Development

We operate mostly on core files, though you can attach to running processes as well.

A future version of Ember will come with a new templating engine known as HTMLBars.

The original motivation for HTMLBars was to allow helpers and properties to have better contextual information about what they were bound to.

So for example, consider a template like this:

<a href="{{url}}">{{link}}</a>
@tripp
tripp / donutchart.js
Last active December 28, 2015 05:59
donutchart.js
var myDataValues = [
{day:"Monday", taxes:2000},
{day:"Tuesday", taxes:50},
{day:"Wednesday", taxes:4000},
{day:"Thursday", taxes:200},
{day:"Friday", taxes:2000}
],
getDonutChart = function(cfg)
{
var pieGraph = new Y.Chart(cfg),
@AndreasMadsen
AndreasMadsen / WhatIHaveDone.md
Last active February 13, 2022 16:15
Playing with smartos
@derek
derek / README.md
Created August 17, 2012 02:06
Loading YUI from the CDN into a Web Worker

Scenario

I want to use YUI inside of a WebWorker thread. Flickr recently wrote a post on this very topic, Web workers and YUI.

Problem

But I want to use YUI's CDN, which WebWorkers prevent because it enforces a same-origin policy with importScripts()

Solution

@jshirley
jshirley / autoview.js
Created July 29, 2012 21:08
AutoView, parse markup to fetch models and views accordingly.
YUI.add('tdp-autoview', function(Y) {
var NS = Y.namespace('TDP'),
View = Y.Base.create('tdpAutoView', Y.View, [], {
render : function() {
this.findViews();
return this;
},
anonymous
anonymous / skullduino arduino side
Created September 18, 2011 16:58
int servopin = 12;
int neckservo = 9;
int servo_position = 2300;
int neck_position = 2400;
int i;
int fetchPos;
int total = 0;
int average = 0;
// for serial communication
@somebox
somebox / gh-like.css
Created July 14, 2011 14:55
github markdown css+script with syntax highlighting. Works with http://markedapp.com
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;
@lukemarsden
lukemarsden / httpRequest.py
Created February 27, 2011 21:11
Simple function to do an HTTP POST using Twisted Agent
from twisted.web.iweb import IBodyProducer
from twisted.internet import defer
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
import urllib
class StringProducer(object):
implements(IBodyProducer)
def __init__(self, body):