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
`import ui.TextView as TextView` | |
class helloWorld extends GC.Application | |
initUI:-> | |
textView = new TextView({ | |
superview: @view | |
layout: "box" | |
text: "Hello, Coffee!" | |
color: "white"}) |
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
// see mawhorter.net for full post | |
// Put this in an after:render event handler. | |
// Be warned: Ripped out of working code and renamed variables without testing. | |
var fabricMain = new fabric.Canvas('main') | |
, fabricThumb = new fabric.Canvas('screenshot') | |
, ctxThumbnail = $('canvas#thumbnail')[0].getContext('2d'); |
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
import {Router, Route} from 'react-router'; | |
import BrowserHistory from 'react-router/lib/BrowserHistory'; | |
import App from './components/App'; | |
import Widget from './components/Widget'; | |
// A wrapper to create a Relay container | |
function createRelayContainer(Component, props) { | |
if (Relay.isContainer(Component)) { | |
// Construct the RelayQueryConfig from the route and the router props. |
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
export const contains = (list = [], test) => list.indexOf(test) >= 0; | |
export const removeItemAt = (list = [], index = 0) => | |
[ | |
...list.slice(0, index), | |
...list.slice(index + 1), | |
]; | |
export const insertItemAt = (list = [], index = 0, item) => | |
[ |
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
export const joinArray = (list = [], separator) => | |
list.reduce((joinedList, item, index, {length}) => { | |
joinedList.push(item); | |
if (index < (length - 1)) { | |
joinedList.push(separator); | |
} | |
return joinedList; | |
}, []); |
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
{ :+ | |
{ :editor | |
{ "pmeta-/" [:toggle-comment-selection] | |
"ctrl-shift-up" [:editor.sublime.selectLinesUpward] | |
"ctrl-shift-down" [:editor.sublime.selectLinesDownward] | |
"pmeta-d" [:editor.sublime.selectNextOccurrence] | |
"ctrl-m" [:editor.sublime.goToBracket] | |
"ctrl-shift-m" [:editor.sublime.selectBetweenBrackets] | |
"shift-pmeta-space" [:editor.sublime.selectScope] | |
"ctrl-pmeta-up" [:editor.sublime.swapLineUp] |
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
command-shift-P > Package > Package Generator: Generate Syntax Theme > mypackage | |
cd ~/.atom/packages/mypackage | |
apm login | |
apm develop mypackage | |
cd ~/github/mypackage | |
sudo chown -R username:wheel . | |
git commit -a -m 'checking everything in' | |
apm publish --tag v2.5.0 minor |
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
define(['transit', 'immutable'], function (Transit, Imm) { | |
'use strict'; | |
var reader = Transit.reader('json', { | |
arrayBuilder: { | |
init: function () { return Imm.List.of().asMutable(); }, | |
add: function (ret, val) { return ret.push(val); }, | |
finalize: function (ret) { return ret.asImmutable(); }, | |
fromArray: function (arr) { return Imm.List(arr); } | |
}, |
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
public class Promises { | |
private static class PageMetrics { | |
Integer visits; | |
Long avgMsOnPage; | |
@Override | |
public String toString() { | |
return String.format("{ avgMsOnPage=%d, visits=%d }", avgMsOnPage, visits); | |
} |
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
// Expected Queueing Time | |
// https://docs.google.com/document/d/1Vgu7-R84Ym3lbfTRi98vpdspRr1UwORB4UV-p9K1FF0/edit | |
// Initial impl by Nicolás Peña (npm), Tim Dresser (tdresser) | |
// Usage: | |
// var eqt = EQT.begin(); | |
// // ... | |
// const {expectedQueueingTime} = EQT.end(); | |
class EQT { | |
constructor() { |
OlderNewer