Skip to content

Instantly share code, notes, and snippets.

View dankmitchell's full-sized avatar
🎯
Focusing

Dan Mitchell dankmitchell

🎯
Focusing
View GitHub Profile
@dankmitchell
dankmitchell / db.rake
Created March 27, 2018 21:35 — forked from benbartling/db.rake
Rake Task - Restore Heroku Postgres to Local DB - Ruby on Rails
#CAPTURE NEW: rails db:restore_from_production\[capture\]
#DOWNLOAD LATEST: rails db:restore_from_production\[download\]
#RESTORE: rails db:restore_from_production
#[HEROKU_APP_NAME] = Name of your heroku app.
#[NUMBER_OF_CORES] = Number of concurrent jobs to run for pg_restore.
namespace :db do
desc 'Pull down the latest backup from Heroku and rebuild your local database with it.'
task :restore_from_production, [:process] => :environment do |task, args|
@dankmitchell
dankmitchell / register-country-and-territory-list.rb
Last active June 15, 2017 09:14 — forked from robmckinnon/register-country-and-territory-list.rb
Get sorted list of territory and country names excluding those with end_dates using Open Register Ruby client
# Add gem
gem 'openregister-ruby-client', git: 'https://github.com/openregister/openregister-ruby-client'
# Inside application.rb
require 'openregister-ruby'
c = OpenRegister.register('country', :beta)._all_records +
OpenRegister.register('territory', :beta)._all_records
c.select{|x| x.end_date.blank?}.map(&:name).sort
var gulp = require('gulp');
var clean = require('gulp-clean');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var bases = {
app: 'app/',

ES6 cheat sheet, with very tasty examples

Declarations

let - prevents javascript hoisting to top of document, variables are scoped to function (no more undefined error when trying to call a var outside a functions scope, you get a ReferenceError which is more predictable/expected).

const - provides constants, cannot be redefined, raises syntax error

Function Arguments