Skip to content

Instantly share code, notes, and snippets.

var loadTypography = function (newStyles, sharedStyles) {
var alignmentHash = {
'left': 0,
'right': 1,
'center': 2,
'justified': 3
};
// removeAllStyles();
@nolastan
nolastan / rough-circle.cocoascript
Last active October 18, 2015 23:55
Creates a really rough circle out of curves
var color = "#dd0000";
var doc = context.document;
var path = NSBezierPath.bezierPath();
var unit = 20;
path.moveToPoint(NSMakePoint(0,0));
[path curveToPoint:NSMakePoint(2*unit,-2*unit) controlPoint1:NSMakePoint(unit,0) controlPoint2:NSMakePoint(2*unit,-unit)];
[path curveToPoint:NSMakePoint(0,-4*unit) controlPoint1:NSMakePoint(2*unit,-3*unit) controlPoint2:NSMakePoint(unit,-4*unit)];
[path curveToPoint:NSMakePoint(-2*unit,-2*unit) controlPoint1:NSMakePoint(-unit,-4*unit) controlPoint2:NSMakePoint(-2*unit,-3*unit)];
@nolastan
nolastan / gist:fe69695d60cd04395c2e
Created June 19, 2015 19:25
Sketch.app – import styles from airtable
var doc = context.document;
var buttons = getButtons();
for (var i=0; i < buttons.length; i++) {
attrs = buttons[i].fields;
var button = createButton(attrs);
doc.currentPage().addLayers([button]);
}
function getButtons() {
var request = NSMutableURLRequest.new();
@nolastan
nolastan / gist:e684753793095a23a819
Created June 1, 2015 23:05
Sketch.app – apply a shared style
var doc = context.document;
var docLayerStyles = [[doc documentData] layerStyles];
var numObjects = [docLayerStyles numberOfSharedObjects];
var sharedStyle = [docLayerStyles sharedObjectAtIndex: 0];
var layer = context.selection[0];
layer.setStyle(sharedStyle.newInstance());

Welcome to San Francisco!

Getting around town

Walk to Fisherman's Wharf by going down the hill and taking a left on Columbus. Or take a right to check out North Beach. We advise against taking taxis – instead, enjoy your first ride free on Lyft (use code STANFORD5) and Uber (use code nedzy).

Dining

Checking out

Cleaners will be coming at 2pm the day of your checkout. If you need to stay later, please coordinate with us. If you're heading to the airport, we suggest scheduling a ride on Wingz. Visit wingz.me/invite/223846 for $5 off your ride.

@nolastan
nolastan / index.haml
Created April 11, 2014 01:33
CSS/SASS Speech Bubbles
.quote
%img.round-avatar{src: 'https://s3.amazonaws.com/uifaces/faces/twitter/stan/48.jpg'}
.speech-bubble
%p
Stanford R.
%span.time-ago
2 minutes ago
%blockquote
"Join me on SaveUp and start being rewarded for saving money!"
@nolastan
nolastan / trapi-node
Created September 24, 2012 19:23
node.js taskrabbit api example
var action = {};
/////////////////////////////////////////////////////////////////////
// metadata
action.name = "oauth-taskrabbit-callback";
action.description = "";
action.inputs = {
"required" : ["code"],
"optional" : []
};
@nolastan
nolastan / gist:3691669
Created September 10, 2012 15:47
tr_python
# Use the py_oauth2 library
# https://github.com/liluo/py-oauth2
from py_oauth2 import oauth2
task_rabbit_client = oauth2.Client(TASK_RABBIT_KEY, TASK_RABBIT_SECRET,
site='https://taskrabbitdev.com',
authorize_url='https://taskrabbitdev.com/api/authorize',
token_url='https://taskrabbitdev.com/api/oauth/token',
header_format= 'OAuth %s')
task_rabbit_access = oauth2.AccessToken(client=task_rabbit_client, token=TASK_RABBIT_ACCESS_TOKEN, header_format= 'OAuth %s')
@nolastan
nolastan / trapi_callback
Created September 6, 2012 23:55
taskrabbit callback data example
{
"items" : [
{
"actor" : {
// user info: who made the offer
},
"created_at" : 1334797665,
"event_type" : "offer_sent", # or offer_made
"offer": {
// offer info
require 'rubygems'
require 'nokogiri'