Skip to content

Instantly share code, notes, and snippets.

@thurt
thurt / mysql-docker.sh
Created November 5, 2017 21:23 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@thurt
thurt / golang-request
Created June 16, 2017 00:42 — forked from kendellfab/golang-request
Golang Example for adding custom headers to a request.
client := &http.Client{]
req, err := http.NewRequest("POST", "http://example.com", bytes.NewReader(postData))
req.Header.Add("User-Agent", "myClient")
resp, err := client.Do(req)
defer resp.Body.Close()
@thurt
thurt / browserify_for_webpack_users.markdown
Created May 30, 2017 23:14
browserify for webpack users

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

@thurt
thurt / gist:eabc4e79f32f1e2f6e65c5051fb11918
Created April 28, 2017 22:26 — forked from chrissimpkins/gist:5bf5686bae86b8129bee
Atom Editor Cheat Sheet (Sweetmeat)

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@thurt
thurt / gist:3a1268314775e6550f9029c117315912
Created April 28, 2017 22:26 — forked from chrissimpkins/gist:5bf5686bae86b8129bee
Atom Editor Cheat Sheet (Sweetmeat)

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@thurt
thurt / setupTestFramework.js
Last active October 3, 2017 20:48 — forked from jsdf/setupTestFramework.js
Make React PropType warnings throw errors in Jasmine/Jest
/* global jasmine */
/* eslint-disable no-console */
// this file is a modified version of https://gist.github.com/jsdf/6fc35890e4ed4a219072
import util from 'util'; // this is a node module
/**
* This file is called by Jest when running tests
* It elevates React PropType console warnings to exceptions.
* This can be helpful because it will prevent tests from passing if PropTypes
* for the component are not valid.
@thurt
thurt / Readme.md
Created January 13, 2017 01:33 — forked from andrey-skl/Readme.md
How to compile and run react-native application from terminal

To run on ios:

  1. Install XCode (recommended) or XCode command line tools by xcode-select --install
  2. Into XCode settings, go to "Downloads" tab and download iOS 9.2 emulator
  3. Compile native app and run it on simulator via npm run ios

To run on Android:

  1. Set up Android environment
  2. Create emulator via npm run android-emulator-create
  3. Run emulator via npm run android-emulator
  4. Compile native code and run it on emulator via npm run android
@thurt
thurt / contentEditable-placeholder.css
Created August 7, 2016 14:01 — forked from oswaldoacauan/contentEditable-placeholder.css
CSS - Placeholder support for contentEditable elements
/ *
* Exemple:
* <div contenteditable="true" placeholder="Enter text here..."></div>
*
*/
[contenteditable=true]:empty:before {
content: attr(placeholder);
}
@thurt
thurt / gist:bfe4dd335b7593157d34c198531489de
Created June 13, 2016 06:25 — forked from sl4m/gist:5091803
create self-signed certificate for localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@thurt
thurt / reload.js
Last active January 17, 2016 19:30 — forked from gleitz/reload.js
Reloading modules from the repl in Node.js
// Reloading modules from the repl in Node.js
// Benjamin Gleitzman (gleitz@mit.edu)
//
// Inspired by Ben Barkay
// http://stackoverflow.com/a/14801711/305414
//
// Usage: `node reload.js`
// You can load the module as usual
// var mymodule = require('./mymodule')
// And the reload it when needed