Skip to content

Instantly share code, notes, and snippets.

View MrNice's full-sized avatar

Nicholas van de Walle MrNice

View GitHub Profile
@MrNice
MrNice / cycle.js
Created March 11, 2014 03:36
Cycle function for sliderSolve
var cycle = function(moveArray, times, direction) {
var i,
j,
length;
times = times || 1;
direction = direction || 'cw';
for( i = 0 ; i < times; i++ ) {
var copy = moveArray.slice();
@MrNice
MrNice / gist:d78fc685532779d9e09f
Created April 30, 2014 22:22
A simple HTML page that has all of Khan Academy's Culture Cow Blurts for easy consumption
<html>
<head>
<title>List of khanacademy culture things</title>
</head>
<body>
<script>
var culturalMsgs = [
"<a href='https://sites.google.com/a/khanacademy.org/forge/for-developers'>Shipping beats perfection</a>.",
"Iterate on ideas before diving into code. <a href='http://www.designstaff.org/articles/product-design-sprint-day-2-diverge-2012-10-26.html'>Design sprints</a> are being organized by Jason and others and work well for both huge projects and small features.",
"Concerned about the hacks in our code? Upset that the product's not good enough? Have no fear, we're getting better fast. Our site used to <a href='https://s3.amazonaws.com/KA-share/old.png'>look like this</a> and it was generated by one big main.py file.",
@MrNice
MrNice / Fun functional object version
Last active August 29, 2015 14:19
QueryString manipulator
// Fun to write an understand version
var R = require('ramda');
function queryToObject(qString) {
// strip ?
// split on &
// split on =
// fromPairs
var noQuestionMark = qString.slice(1);
var kvArray = noQuestionMark.split('&');
Up front, the major differences between CLJS & Polymer versions
1. Polymer version is easier to load asynchronously; it brings its own stylesheet
2. CLJS version uses a `map`, doesn't need special inner template
3. CLJS version data flow is clearer, once one accepts the reagent/atom
4. CLJS version doesn't need the first template, as one simply calls the function as needed
5. Polymer version needs the dom-module tag and an id, CLJS doesn't
6. I have no idea what the performance difference between these components is. Hiccup -> HTML is an extra conversion, but so is HTML -> JS -> HTML.
Altogether, there aren't very many differences between these a Reagent component and a Polymer component.
@MrNice
MrNice / doWork.js
Created November 20, 2015 23:31
How to work
function work(project) {
project.setup();
while (not(project.finished)) {
try {
project.next();
} catch (unknown) {
reality = think(unknown);
mental-model = visualize(mental-domain-model, project.current-task);
solution = search(difference(mental-model, reality));
project.debug(solution);
@MrNice
MrNice / api-peek.sh
Created December 2, 2015 18:48
API Peek
# get these into your shell somehow
# apI PeeK: Look at an API response and temp save it
function ipk {
echo "Don't use the output flag from curl as it redirects"
curl "$@" | python -m json.tool | tee "apipeek.json" | less
}
# I PicK UP: rename the peeked api response (just partially applied mv)
function ipkup {
@MrNice
MrNice / gist:7150535
Created October 25, 2013 07:07
This is my uploaded cheat sheet to typing.io that I'm using in order to master the most basic of Javascript language declarations. I was told that I should be able to type any one of these fragments in roughly 5 seconds, so I'm aiming for 3 apiece.
//THIS IS MY STUDY SHEET FOR TYPING.IO FOR GETTING INTO HACK REACTOR
//IF ANYONE ELSE EVER SEES THIS< PLEASE BE OK WITH USING IT.
var myFunc = function(arg1, arg2) {
};
for(var i = 0; i< array.length; i++){
};
@MrNice
MrNice / ajumblefun
Last active December 28, 2015 20:09
Dictionary jumble solver, created at Hack Reactor's Biweekly algorithm meetup. This is a recursive, functional version, which aims to be more legible. It's not.
// Functional Jumble Solver in Javascript!
// Nicholas, Mike, William
// https://github.com/MrNice
// https://github.com/mmessing
// https://github.com/oddalot
//Will add tests and timers later. I want to make this //fast//
var fs = require('fs');
var _ = require('underscore');
@MrNice
MrNice / taxes.md
Last active January 22, 2016 17:41
Increase Transparency, Increase Trust

I live in the United States and work a salaried job.

A full third of my income goes to taxes.

Federal Taxes account for one fourth of that.

Put another way, if all taxes were eliminated, I would make one and a half times more.

However, I don't think paying taxes is a bad thing.

@MrNice
MrNice / docktest.yml
Created November 21, 2015 01:33
Ansible Mac OS X install app w/ brew and add to the Dock
# TODO: Get version from registering output of brew cask install
- name: "install browser: {{ browser }}"
homebrew_cask: >
name={{ browser }}
state=present
- name: read defaults to know what to add to the dock
shell: defaults read com.apple.dock
register: apple_defaults