Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Bailey newtriks

View GitHub Profile
@newtriks
newtriks / index.js
Created December 11, 2017 18:43 — forked from bahmutov/index.js
Kleisli composition example (JSON parsing + deep property)
View index.js
// following along https://medium.com/@luijar/kliesli-compositions-in-javascript-7e1a7218f0c4
const R = require('ramda')
const Maybe = require('ramda-fantasy').Maybe
// parse JSON string into object
// parse :: String -> Object | Null
function parse(s) {
try {
return JSON.parse(s)
} catch (e) {
@newtriks
newtriks / webpack.config.production.js
Created November 21, 2017 16:02 — forked from DavidLazic/webpack.config.production.js
Webpack production config
View webpack.config.production.js
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PreloadWebpackPlugin = require('preload-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const StyleExtHtmlWebpackPlugin = require('style-ext-html-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const autoprefixer = require('autoprefixer');
@newtriks
newtriks / webpack.config.production.js
Created November 21, 2017 16:02 — forked from DavidLazic/webpack.config.production.js
Webpack production config
View webpack.config.production.js
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PreloadWebpackPlugin = require('preload-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const StyleExtHtmlWebpackPlugin = require('style-ext-html-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const autoprefixer = require('autoprefixer');
@newtriks
newtriks / logger.js
Created January 19, 2017 11:09 — forked from OlavHN/logger.js
redux middleware with firebase replay / remote actions
View logger.js
import Firebase from 'firebase';
const firebaseUrl = 'https://spatially.firebaseio.com/clients';
const timeOffsetUrl = 'https://spatially.firebaseio.com/.info/serverTimeOffset';
let ref = new Firebase(firebaseUrl);
let timeRef = new Firebase(timeOffsetUrl);
let cachedUid;
export default ({dispatch, getState}) => next => action => {
// The first action rehydrates, so now we've probably got the uid now
@newtriks
newtriks / gist:83205d4b07d73f22cdf68184f644444f
Last active September 10, 2016 14:25 — forked from chrissimpkins/gist:5bf5686bae86b8129bee
Atom Editor Cheat Sheet (Sweetmeat)
View gist:83205d4b07d73f22cdf68184f644444f

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
@newtriks
newtriks / HttpAction.elm
Created November 19, 2015 09:27 — forked from berndca/HttpAction.elm
Http.getString at startup
View HttpAction.elm
import StartApp
import Http
import Markdown
import Html exposing (Html, div, button, text)
import Html.Events exposing (onClick)
import Task exposing (Task)
import Effects exposing (Effects)
-- the URL of the README.md that we desire
readmeUrl : String
View superheroes.js
'use strict';
module.exports = {
data: [{
'id': 0,
'name': '3-D Man'
}, {
'id': 1,
'name': 'A-Bomb (HAS)'
}, {
@newtriks
newtriks / app.js
Last active September 5, 2018 06:09
Playing with immutable state using RxJS
View app.js
import {List, Record, toJS} from 'immutable';
import Rx, {Observable, Subject} from 'rx';
const initialState = Record({count: 0, text: '', items: List(), history: List(), future: List()});
const subject = new Subject();
const source = Observable.merge(subject)
.scan((currentState, action) => action(currentState), initialState());
source.subscribe(
state => {
@newtriks
newtriks / gist:4f1fcef9da7dde4c91bf
Last active August 29, 2015 14:04
If using #OSX LiveReload app add to ‘Run a custom command’ which’ll display a notification #Mavericks
View gist:4f1fcef9da7dde4c91bf
osascript -e 'display notification "Reloaded browser..." with title "LiveReload"'