Skip to content

Instantly share code, notes, and snippets.

View nybblr's full-sized avatar
🌱
I help developers craft their best work, achieve goals, and never stop growing.

Jonathan Lee Martin nybblr

🌱
I help developers craft their best work, achieve goals, and never stop growing.
View GitHub Profile
@nybblr
nybblr / apa-to-mla.md
Last active January 24, 2021 07:01
APA to MLA commas

Convert from APA style commas to MLA

This is for all your writer friends: for the MLA or APA purist, why not introduce a little excitement to their day with a belated April fools prank?

Installation

Download the comma script and chmod +x comma to make it executable.

Usage

@nybblr
nybblr / drop-zone.emblem
Created June 25, 2015 22:06
Ember file uploads
div style="width:500px;height:500px;border:1px solid black;"
button click="browse"
| Browse
button click="upload"
| Upload
file-upload url="/files" onfile="onfile"
= yield
@nybblr
nybblr / ember-data-stores.md
Created January 26, 2016 17:26
Ember Data: Multiple data stores

Multiple Ember Data stores

Need a separate data store? Maybe a temporary one for search results? Go for it!

// app/components/search-box.js
import Ember from 'ember';

export default Ember.Component.extend({
  store: Ember.inject.service('search-store'),
@nybblr
nybblr / 1-easy.js
Last active July 13, 2022 03:40
3 examples of using Async Generators and Async Iteration in JavaScript!
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {
@nybblr
nybblr / dijkstra.js
Last active July 29, 2019 21:17
Dijkstra's Algorithm in JavaScript.
var graph = [
'AB6',
'AC3',
'BD6',
'CD5',
'CE9',
'DF8',
'DE3',
'EG8',
'FG2'
@nybblr
nybblr / .babelrc
Created March 7, 2017 18:00
ES2017 build pipeline in 5 seconds.
{
"presets": [
"es2015",
"es2016",
"es2017"
],
"plugins": []
}
@nybblr
nybblr / example.js
Last active April 5, 2018 15:34
In-browser image resizing + processing
import processImage from 'process-image';
var file = /* File() object from drag-n-drop or file input */
var imageProcessOpts = {
maxWidth: 1200,
maxHeight: 1200,
quality: 0.6
};
@nybblr
nybblr / metaproxy.js
Created October 28, 2017 18:43
Metaproxy: The proxy that doesn't do anything
/* Metaproxy
* The proxy that doesn't do anything
**/
let target = { a: 1, b: 2, c: 3 }
let handler = new Proxy({}, {
get: (...args) => Reflect[args[1]](...args)
})
@nybblr
nybblr / ghost-to-static.sh
Last active December 21, 2017 12:48
Crawl a local Ghost blog instance and convert to a production-ready static site!
#!/bin/bash
DEV_HOST="localhost:2368"
PROD_HOST="blog.yellowscale.com"
BUILD_DEST=${1:-./build}
DEV_URL="http://${DEV_HOST}"
PROD_URL="https://${PROD_HOST}"
# Hop into build directory
pushd $BUILD_DEST > /dev/null
@nybblr
nybblr / slacks-or-shorts.js
Created January 16, 2018 16:02
Should you wear slacks, or should you wear shorts? This Slackbot will help you decide.
const SlackBot = require('slackbots');
const BOT_NAME = 'Slacks or Shorts';
const BOT_TOKEN = '<YOUR-TOKEN-HERE>';
const BOT_HANDLE = 'slacks-or-shorts';
let bot = new SlackBot({
token: BOT_TOKEN,
name: BOT_NAME
});