Skip to content

Instantly share code, notes, and snippets.

View kaosat-dev's full-sized avatar

Mark Moissette kaosat-dev

View GitHub Profile
@kaosat-dev
kaosat-dev / codepen.md
Created December 2, 2017 15:12 — forked from serapath/codepen.md
A synchronous `require` function for the browser that downloads and caches modules from npm - just copy & paste it to the dev tools javascript console

use require in a codepen

  1. click on the little icon Open JS Settings on the JavaScript editor pane
  2. Then add the following link under Add External Javascript
https://cdn.rawgit.com/serapath/e2b55cab315e60fbbffea7b43acd8749/raw/a2709905ca06830f78d6069b97cda1f18eb9ef4c/require.js
  1. Press Save & Close and start using the require(...) in your JavaScript code on codepen
@kaosat-dev
kaosat-dev / .gitignore
Created November 10, 2017 20:24 — forked from claudiopro/.gitignore
require-from-dat
/node_modules/
module.js
@kaosat-dev
kaosat-dev / auto-deploy.md
Created May 5, 2017 07:12 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@kaosat-dev
kaosat-dev / commonjs-to-es6-modules.js
Created April 20, 2017 09:16 — forked from wegry/commonjs-to-es6-modules.js
purescript psc 0.9 output webpack loader that allows tree shaking
"use strict"
/*
* Webpack 2 loader that can take CommonJS output by psc 0.9.1 and convert
* it into tree shakable ES6 modules. No transpiling required.
*/
const fs = require('fs')
const commonJsRequire = /var ([$\w]+) = require\("(.*)"\)/g
const moduleExports = /module\.exports = \{(\n( ([$\w]+): ([$\w]+)(, )?\n)*)?\};/m
@kaosat-dev
kaosat-dev / clone-all-twitter-github-repos.sh
Created March 29, 2017 10:09 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@kaosat-dev
kaosat-dev / 0-Simple counter: different implementations...
Created March 14, 2017 14:33 — forked from srdjan/100+ different counter apps...
Simple counter: different implementations...
different implementations of the simple counter app... code verbosity vs expressiveness
@kaosat-dev
kaosat-dev / railway_oriented_programming.js
Created March 9, 2017 12:40 — forked from volodymyrprokopyuk/railway_oriented_programming.js
Railway Oriented Programming (JavaScript)
var _ = require('lodash');
var Success = function(success) { this.success = success; };
var Failure = function(failure) { this.failure = failure; };
var bindAll = function(fs) {
var bind = function(res, f) {
return res instanceof Success ? f(res.success) : res;
};
var bindF = function(f) { return _.partial(bind, _, f); };
@kaosat-dev
kaosat-dev / git-serve.md
Created February 24, 2017 07:13 — forked from datagrok/git-serve.md
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.

Launch a one-off git server from any local repository.

I [tweeted this already][1] but I thought it could use some expansion:

Enable decentralized git workflow: git config alias.serve "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/"

Say you use a git workflow that involves working with a core "official" repository that you pull and push your changes from and into. I'm sure many companies do this, as do many users of git hosting services like Github.

Say that server, or Github, goes down for a bit.

@kaosat-dev
kaosat-dev / cycle-state-ramda.md
Created February 18, 2017 13:48 — forked from wclr/cycle-state-ramda.md
A way to handle state in cycle.js

A way to handle state in cycle.js

Simple state management with xstream and ramda, in more transparent fashion than onionify

import * as R from 'ramda'

// first we create factory for making special state stream 
// that will hold our stream value and will be modified with supplied streams of reducers
type StateReducer<T> = (state: T) => T

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {