Skip to content

Instantly share code, notes, and snippets.

View don-smith's full-sized avatar
🧘

Don Smith don-smith

🧘
  • HYPR
  • Auckland, NZ
View GitHub Profile
@don-smith
don-smith / generators.md
Created October 24, 2015 20:14 — forked from learncodeacademy/generators.md
What are Javascript Generators?

##what are generators##

  • They're pausable functions, pausable iterable functions, to be more precise
  • They're defined with the *
  • every time you yield a value, the function pauses until .next(modifiedYieldValue) is called
var myGen = function*() {
  var one = yield 1;
  var two = yield 2;
  var three = yield 3;
 console.log(one, two, three);
/**
* Originally created in JS Bin: http://jsbin.com/yetubi/edit?js,console
* Dependencies: lodash
*
* This script finds 4 whole number values that have a specific relationship.
* Specifically, the sum of the squares of 3 numbers when they equal the
* square root of the 4th number. In linear algebra terms, this calculates
* the absolute value of a vector [x, y, z] when all values and the result
* are whole numbers. This formula is also known to calculate the distance
* of a 3D point from zero: d = sqrt(x*x + y*y + z*z)
@don-smith
don-smith / README.md
Last active January 3, 2016 02:29 — forked from syntagmatic/README.md
Force directed cell splitting

Links being severed over time inside of a convex hull

@don-smith
don-smith / README.md
Last active January 3, 2016 02:18 — forked from syntagmatic/README.md
Early cell splitting concept
@don-smith
don-smith / meteor-dump.sh
Last active January 18, 2021 03:17 — forked from olizilla/meteor-dump.sh
A couple of shell scripts to dump and restore production Meteor (MongoDB) databases.
#!/bin/bash
# __
# _____ ____ _/ |_ ____ ____ _______
# / \ _/ __ \ \ __\_/ __ \ / _ \ \_ __ \
# | Y Y \\ ___/ | | \ ___/ ( <_> ) | | \/
# |__|_| / \___ > |__| \___ > \____/ |__|
# \/ \/ \/
#
# .___
# __| _/ __ __ _____ ______
(function($){
$.widget("ui.mywidget", {
options: {
autoOpen: true
},
_create: function(){
// by default, consider this thing closed.
development: &global_settings
database: textual_development
host: 127.0.0.1
port: 27017
test:
database: textual_test
<<: *global_settings
production:
@don-smith
don-smith / rails_heroku_mongohq_template.rb
Created May 17, 2010 07:13 — forked from banker/Rails MongoMapper Template.rb
a rails mongo_mapper template when using heroku's mongohq addin
# rails_heroku_mongohq_template.rb
#
# fork of Kyle Banker's Rails MongoMapper Template (http://gist.github.com/219223)
# and modified to work with heroku's mongohq addon.
#
# To use:
# rails project_name -m http://gist.github.com/403483.txt
# (preface with 'sudo' if you think you might need some gems)
# remove unneeded defaults