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
doc.addPage(); | |
// add content | |
// this sets the height in the actual PDF output | |
// MediaBox[1] is really the Y, but PDFs use a flipped coordinate system | |
// where y=0 is at the bottom. | |
// make sure you do this before adding another page | |
doc.page.dictionary.data.MediaBox[1] = doc.page.height - doc.y; |
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
var $ = require('jquery'); | |
var transitionEvents = 'transitionend msTransitionEnd webkitTransitionEnd'; | |
var visibilityEvents = 'visibilitychange mozvisibilitychange msvisibilitychange webkitvisibilitychange'; | |
/** | |
* Runs the given callback when the next transition on the selected element finishes. | |
* Sometimes the transitionend event doesn't fire when the page is in a | |
* background tab, so we also handle the page visibility events here too. | |
*/ |
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
DBC = new r.Struct | |
# ... | |
stringBlockOffset: -> 4 * 5 + @recordCount * @recordSize | |
ptr: new r.Pointer(uint32le, new r.String(null), relativeTo: 'stringBlockOffset') |
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
webView = [[CPWebView alloc] initWithFrame:CGRectMake(199,0,(CGRectGetWidth(bounds)-199),CGRectGetHeight(bounds))]; | |
[webView setAutoresizingMask: CPViewWidthSizable | CPViewHeightSizable]; | |
[webView loadHTMLString:@"<center><h3>Tmp String</h3></p>"]; | |
[contentView addSubview:webView]; | |
var request = [CPURLRequest requestWithURL:"Your URL Here!"]; | |
listConnection = [CPURLConnection connectionWithRequest:request delegate:self]; | |
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
docs = [CPDictionary dictionary]; | |
var request = [CPURLRequest requestWithURL:"your xml file here!"]; | |
listConnection = [CPURLConnection connectionWithRequest:request delegate:self]; | |
//Connection Delegate Stuff | |
- (void)connection:(CPURLConnection) aConnection didReceiveData:(CPString)data | |
{ | |
if (aConnection == listConnection){ | |
var tmp = document.createElement("div"); | |
tmp.innerHTML = data; |
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
/* | |
Path parser by Devon Govett | |
Input: String path | |
Returns: Array of objects with command and arguments | |
*/ | |
//Number of allowed parameters for each command | |
var parameters = { | |
A: 7, | |
a: 7, |
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
class Animal | |
move: (meters) -> | |
alert @name + " moved " + meters + "m." | |
class Snake extends Animal | |
constructor: (name) -> | |
@name: name | |
move: (distance) -> | |
alert "Slithering..." |
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
__hasProp: true | |
yearsOld: {max: 10, ida: 9, tim: 11} | |
ages: for child, age of yearsOld | |
child + " is " + age | |
# compiles into this JavaScript, which will not work | |
var _a, _b, age, ages, child, yearsOld; | |
var __hasProp = Object.prototype.hasOwnProperty; | |
__hasProp = 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
// #1. Standard hash, but with relationships defined outside of that hash | |
db.define('Employee', { | |
name: Record.type('String').required(), | |
employee_number: Record.type('Number').defaultValue(123) | |
}) | |
Employee.hasOne('Office') |
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
Employee = new db.Model(function() { | |
this.key("name", String, { required: true }); | |
this.key("email", String); | |
this.hasMany("Office"); | |
}) |
OlderNewer