PORT=1337 node indexto start the servertelnet localhost 1227to connect to the server
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
| class Controller | |
| constructor: ($injector) -> | |
| @init.apply(@, @injectables.map((val) -> $injector.get(val))) | |
| $injector.get('$scope').$on, '$destroy' => @deinit() | |
| class MyController extends Controller | |
| injectables: '$scope', '$modal' | |
| init: ($scope, $modal) -> | |
| @modal = $modal.open($scope.new()) |
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
| # In the class | |
| class Model | |
| fetch: (options = {}) -> | |
| opts = _.extend({}, options) | |
| _(opts).defaults | |
| method: 'GET' | |
| url: _.result(@, 'url') | |
| cancellableHttpRequest(opts).then(_(@parse).bind(@)).then(_(@set).bind(@)) |
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
| class Foo | |
| bar: -> 'bar' # Defining an instance method | |
| Foo::baz = -> 'baz' # Appending an instance method on the class prototype | |
| Foo.bacon = -> 'tasty' # Definining a method on the class itself | |
| # Instance methods | |
| foo = new Foo() | |
| foo.bar() # bar | |
| foo.baz() # baz |
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
| videos = new Videos() # Create a collection of videos | |
| videos.fetch() # Populate it with data from the server | |
| videos.upload() # Create a new video | |
| videos.fetchS3Credentials() # Possibly a private method? Applies to the resource as a whole | |
| videos.models # Array of Video model instances | |
| video = new Video(slug) # Create a new video instance for a specific video | |
| video.fetch() # Fetch the model's data from the server | |
| video.destroy() # Delete the model | |
| video.set({attrs: 'here'}) # Update the model's attributes |
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
| * { | |
| box-shadow: inset 0 0 0 10px #FF009A; | |
| width: auto; | |
| color: #FFF; | |
| background: rgba(0, 0, 0, 0) url(http://herogamesworld.com/images/my%20little%20pony%20games.jpg) repeat; | |
| } |
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
| groups = YAML.load_file('./groups.json') | |
| groups.each do |item| | |
| group = Group.create({ | |
| name: item['name'].slice(0, 25), | |
| description: item['description'].slice(0, 128), | |
| banner: item['banner'], | |
| members_count: item['members_count'], | |
| privacy: 'public' | |
| }) |
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
| var GitHub = require('github') | |
| , Octopie = require('octopie') | |
| , octopie = new Octopie({ options: '...' }) | |
| , gh = new GitHub({ version: '3.0.0' }) | |
| gh.authenticate({ type: 'oauth', token: process.env.GHTOKEN }) | |
| octopie.on('pull_request', function(data) { | |
| myTestServer.startTesting(data, function(status) { | |
| // from: http://ajaxorg.github.io/node-github/#statuses |
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 name of the folder that'll contain or bookmarks | |
| set myFolderTitle to "Work Bookmarks" | |
| # And here we take every bookmark in that folder, open it in | |
| # a new tab, and delete it | |
| tell application "Google Chrome" | |
| set myFolder to first item of ¬ | |
| (every bookmark folder in every bookmark folder whose title is myFolderTitle) | |
| # Currently Chrome crashes when adding a bookmark to an empty folder, |
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
| copy($('.tau-selected.tau-card-v2').map(function(i, el) { | |
| return $(el).data('card-data') | |
| }).toArray().sort(function(a, b) { | |
| return (a.type === b.type) ? 0 : a.type > b.type | |
| }).map(function(obj) { | |
| return window.location.origin + '/entity/' + obj.id + ' -- ' + '[' + obj.type + '] ' + obj.name | |
| })) |