This file contains hidden or 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
Synthesizing 10/10 solutions | |
======= | |
// render a marketplace that sells apps | |
import { Component, OnInit } from '@angular/core'; | |
import { ActivatedRoute, Router } from '@angular/router'; | |
import { MarketplaceService } from '../marketplace.service'; | |
import { App } from '../app'; |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
#!/bin/bash | |
if [ "$#" == "0" ]; then | |
echo "Usage: ccs [-n] file1 ... fileN" | |
echo "Compiles CoffeeScript files to JavaScript and emits the result to stdout." | |
echo " -n prepend line numbers" | |
exit 1 | |
fi | |
if [ "$1" == "-n" ]; then |
This file contains hidden or 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
{EventEmitter} = require "events" | |
# The Model base class | |
exports.Model = class Model | |
property = (k, events) -> | |
event = "change:#{k}" | |
fn = (v) => | |
orig = if @_data[k]? then @_data[k] else null |
This file contains hidden or 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
# The Model base class | |
class Model | |
prop = (k, props) -> (v) -> if v then props[k] = v else if v is null then delete props[k] else props[k]? or null | |
@properties: (defaults) -> (@::[k] = prop k, (@::_props = {}))(v) for own k, v of defaults | |
# Example usage by a subclass | |
class Foo extends Model | |
@properties |
This file contains hidden or 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
function r(f){/in/(document.readyState)?setTimeout(r,9,f):f()} |
This file contains hidden or 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
// OpenAjax Hub 1.0 implementation by Robert Bergman, designed to minify to under 1k. | |
// This code may be freely distributed under an MIT-style licence. | |
OpenAjax = { | |
hub: (function () { | |
var oa = 'openajax', // Literal reuse | |
r = 'registerLibrary', // Literal reuse | |
s = 'subscribe', // Literal reuse | |
l = 'libraries', // Literal reuse | |
p = 'publish', // Literal reuse | |
ns = 'org.' + oa + '.hub.', // Local event prefix |
This file contains hidden or 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
/* | |
* Copyright 2008, Robert Bergman. | |
* This code may be freely distributed under an MIT-style licence. | |
* | |
* A jQuery plugin to make URI parsing and creation from templates and values easy. | |
* | |
* Use: | |
* var uri = jQuery.uri(); | |
* Creates a new, empty URI object | |
* |