Skip to content

Instantly share code, notes, and snippets.

View newswim's full-sized avatar
🦬
Hi

Dan Minshew newswim

🦬
Hi
View GitHub Profile
@newswim
newswim / deeper_delete.js
Created March 10, 2017 05:57
A super simple CLI for making REST requests to Shopify. Modify with whatever methods you want!
// README: https://gist.github.com/newswim/a99b09a13e80c262d61915f0f28a51b1
// For instructions on `shopify-api-node`
// see: https://github.com/christophergregory/shopify-node-api
#!/usr/bin/env node
"use strict"
const clear = require('clear')
const inquirer = require('inquirer')
@newswim
newswim / readme.md
Last active August 3, 2017 14:46
Deep Delete - readme

Start-up

  • Clone this repo
  • yarn or npm install
  • Create a file config/secrets.json -- Only the first 4 fields are required
{
  "api_key" : "",
  "shopName" : "",
 "password" : "",
@newswim
newswim / init.coffee
Last active February 26, 2017 05:12
Atom Sync Settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@newswim
newswim / denton_canopy.json
Last active February 4, 2017 16:31
Data from Canopy Planner
{"status":"OK","personal_settings":{"account":{"login_notes":"","pid":1,"admin_1_manage_org":true,"admin_2_manage_org":false,"admin_1_manage_users":true,"admin_2_manage_users":false,"request_accounts":false,"admin_3_manage_org":false,"admin_3_manage_users":false,"admin_1_zoom_to_data_on_login":true,"admin_2_restrict_to_own_data":false,"default_base_user":"public_1","with_login_sc":true,"from_email":"info@planitgeo.com","admin_2_zoom_to_data_on_login":false,"admin_3_zoom_to_data_on_login":false,"public_1_zoom_to_data_on_login":false,"admin_1_restrict_to_own_data":false,"admin_3_restrict_to_own_data":true,"public_1_restrict_to_own_data":false,"to_email":null,"default_logged_in_user":"admin_2","with_forgot_pword":true,"with_mng_account":true,"users_extra_parameters":null,"with_self_reg_role":false,"overwrite_user_type_self_reg":true,"admin_4_manage_org":false,"admin_4_manage_users":false,"admin_4_zoom_to_data_on_login":false,"admin_4_restrict_to_own_data":true,"admin_5_manage_org":false,"admin_5_manage_users":fa
@newswim
newswim / object-create.js
Created November 17, 2016 02:59
Object.create simple polyfill
/**
* @param {object} o - this object will be the Prototype of the newly created object.
*/
if (!Object.create) {
Object.create = function (o) {
if (arguments.length > 1) {
throw new Error('Object.create implementation only accepts the first parameter.');
}
function F() {}
@newswim
newswim / dump.raw
Created October 19, 2016 23:34
Compiling gcc in order to get through `rvm requirements`
ln -s ../../../Cellar/gcc49/4.9.3/share/man/man7/fsf-funding-4.9.7 fsf-funding-4.9.7
ln -s ../../../Cellar/gcc49/4.9.3/share/man/man7/gfdl-4.9.7 gfdl-4.9.7
ln -s ../../../Cellar/gcc49/4.9.3/share/man/man7/gpl-4.9.7 gpl-4.9.7
ln -s ../Cellar/gcc49/4.9.3/lib/gcc gcc
==> Summary
🍺 /usr/local/Cellar/gcc49/4.9.3: 1,181 files, 196M, built in 38 minutes 19 seconds
➜ ~ rvm requirements -v
Checking requirements for osx.
^C% ➜ ~ rvm requirements --verbose
Checking requirements for osx.
@newswim
newswim / example.js
Created September 27, 2016 16:52
Fetching data with React's constructor
// I did not write this.
var url = "https://jsonplaceholder.typicode.com/albums"
// Auto unwrap the response as we want the data not the full headers for this simple example
const stringifyResponse = response => {
if (response.status >= 400) throw new Error(response)
return response.headers.get("Content-Type").includes("application/json") ? response.json() : response.text()
}
@newswim
newswim / gist:80620811d6843ebedad95f51b1715a66
Last active August 6, 2016 00:48 — forked from FrancescaK/gist:3832833
Password Testing Scenario
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
bcrypt = require('bcrypt'),
SALT_WORK_FACTOR = 10;
var UserSchema = new Schema({
username: { type: String, required: true, index: { unique: true } },
password: { type: String, required: true }
});
@newswim
newswim / JavaScript--The-Good-Parts.md
Created July 14, 2016 22:22
JavaScript code walkthroughts from Douglas Crockfords' book
@newswim
newswim / hapijs-rest-api-tutorial.md
Created May 9, 2016 15:31 — forked from agendor/hapijs-rest-api-tutorial.md
A practical introduction to building a RESTful API with the hapi.js server framework for Node.js