Skip to content

Instantly share code, notes, and snippets.

Dean Radcliffe deanius

Block or report user

Report or block deanius

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View async_ruby.rb
# some of the syntax requires Ruby 2.5+
module Async
refine BasicObject do
def async(&block)!
def enqueue(&block)
::Fiber.yield [:append, block]
JoshCheek / observer_async_options.js
Last active Mar 6, 2019
Three variations on async
View observer_async_options.js
// based on
// three different algorithms on async, with a fake file system that's easy to modify
const { agent } = require("rx-helper");
// Timer (useful for understanding how output gets processed)
const start = new Date()
const log = (whatevz) => console.log(new Date() - start, whatevz)
// Fake slow file system:
View eventStub.js
const eventStub = value => ({
stopPropagation: () => {},
preventDefault: () => {},
persist: () => {},
target: {
checked: value,
gaearon / connect.js
Last active Jul 18, 2019
connect.js explained
View connect.js
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
deanius /
Last active Aug 29, 2015
Meteor package.json for fun and profit

Why use pacakge.json with Meteor ?

  • Keep the preferred port with the project
  • Each project need not run on port 3000 (Keep your favicon.ico from getting confused!)
  • Start up with settings.json in a conventional way
  • Install utils with your project, like spacejam, ESLint, etc..
  • Have a uniform interface between package projects and meteor apps

How to use it ?

nolanlawson / protips.js
Last active Jul 11, 2019
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
View extract_meteor_deps.js
// p = require('./extract_meteor_deps');
// Package = p.Package;
// getPackageDeps = p.getPackageDeps; depsByPackage = p.depsByPackage;
// > getPackageDeps('spacebars')
// ['htmljs', 'blaze', 'observe-sequence', 'templating']
// > depsByPackage
// {"spacebars": ['htmljs', 'blaze', 'observe-sequence', 'templating']}
var Package, api, depsByPackage, getPackageDeps, mockApiUse, _;
deanius / load-it.js
Last active Aug 29, 2015
Load core Meteor Libraries for a Meteor-style REPL in the browser
View load-it.js
var loadScript = function(url){
var d=document;
var s=d.createElement('script');
(d.head || d.documentElement).appendChild(s)
/*needed for reactive-coffee, and meteor*/
/*Tracker.autorun (as, ReactiveDict (as ReactiveMap), ReactiveVar, and ReactiveObject */
fraserxu / auth.js
Last active Feb 6, 2018
Handling CORS in Meteor app
View auth.js
* packages/reststop2/auth.js
* Add a method to handle OPTIONS request
// return nothing
RESTstop.add('login', {'method': 'OPTIONS'}, function() {})
View 1-meteor-internationalization.bash
# This little gist shows how to easily internationalize your application using the meteor-just-i18n package.
# Package repository:
# 1. Adding the package.
$ meteor add anti:i18n
You can’t perform that action at this time.