Skip to content

Instantly share code, notes, and snippets.

View jurassix's full-sized avatar
🐢
hello world

Clint Ayres jurassix

🐢
hello world
View GitHub Profile
@jdoig
jdoig / Application.coffee
Last active December 13, 2015 19:58
hello-world for game{closure} in coffeescript
`import ui.TextView as TextView`
class helloWorld extends GC.Application
initUI:->
textView = new TextView({
superview: @view
layout: "box"
text: "Hello, Coffee!"
color: "white"})
@cmawhorter
cmawhorter / fabricjs-thumbnail.js
Created June 26, 2014 04:54
The only way I could generate real-time thumbnails of a fabricjs canvas
// 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');
@cpojer
cpojer / app.js
Last active February 8, 2016 02:40
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.
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) =>
[
export const joinArray = (list = [], separator) =>
list.reduce((joinedList, item, index, {length}) => {
joinedList.push(item);
if (index < (length - 1)) {
joinedList.push(separator);
}
return joinedList;
}, []);
@tonsky
tonsky / user.keymap
Created June 4, 2014 12:04
LightTable keymap of Sublime shortcuts
{ :+
{ :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]
@awatson1978
awatson1978 / gist:a0df5fef953b9da01ce1
Last active May 19, 2017 11:57
Publish an Atom Package
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
@Tvaroh
Tvaroh / TransitSvc.js
Last active June 2, 2017 19:40
transit-js bridge to immutable 3.0
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); }
},
@danveloper
danveloper / Promises.java
Created April 16, 2013 19:40
Java 8 CompletableFuture (Promise) and Lambda example
public class Promises {
private static class PageMetrics {
Integer visits;
Long avgMsOnPage;
@Override
public String toString() {
return String.format("{ avgMsOnPage=%d, visits=%d }", avgMsOnPage, visits);
}
@paulirish
paulirish / eqt.js
Last active April 26, 2020 01:14
Expected Queueing Time metric
// 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() {