Skip to content

Instantly share code, notes, and snippets.

View Whoaa512's full-sized avatar
❤️
Love

C.J. Winslow Whoaa512

❤️
Love
View GitHub Profile
My thoughts on writing tiny reusable modules that each do just one
thing. These notes were adapted from an email I recently sent.
***
If some component is reusable enough to be a module then the
maintenance gains are really worth the overhead of making a new
project with separate tests and docs. Splitting out a reusable
component might take 5 or 10 minutes to set up all the package
overhead but it's much easier to test and document a piece that is
@Whoaa512
Whoaa512 / BST.elm
Created September 23, 2015 19:10
Elm BST challenges
{-----------------------------------------------------------------
A "Tree" represents a binary tree. A "Node" in a binary tree
always has two children. A tree can also be "Empty". Below I have
defined "Tree" and a number of useful functions.
This example also includes some challenge problems :)
-----------------------------------------------------------------}
@Whoaa512
Whoaa512 / gulfile.js
Created October 15, 2015 04:01
Gulpfile for simple elm project
var concat = require('gulp-concat')
var concatCss = require('gulp-concat-css')
var csso = require('gulp-csso')
var del = require('del')
var elmBins = require('elm')
var glob = require('glob')
var gulp = require('gulp')
var jade = require('gulp-jade')
var jadeConcat = require('gulp-jade-template-concat')
var simpleSpawner = require('simple-spawner')
#!/usr/bin/env bash
# Setup script for hacking chrome devtools
# Source -> https://medium.com/p/8c8896f5cef3
echo "Creating folder and initialize a git repo"
mkdir devtools-frontend && cd devtools-frontend
git init
echo "Adding chromium remote and initialize sparse checkout"
git remote add upstream https://chromium.googlesource.com/chromium/blink
@Whoaa512
Whoaa512 / startup.sh
Created August 26, 2016 15:53
Kia's aws startup script
#!/usr/bin/env bash
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Update the package manager's listings
echo "Updating the package manager's listings"
@Whoaa512
Whoaa512 / app.html
Last active August 7, 2017 17:44
Meteor code to user FB.ui & the FB SDK
<body>
{{#constant}}
<div id="fb-root"></div>
{{/constant}}
<div> {{> fb_pic}} {{loginButtons}}</div>
<br />
<div><h2>Click to post to your feed:</h2> {{> feed}} </div>
</body>
@Whoaa512
Whoaa512 / test.js
Last active August 17, 2017 23:57 — forked from adnanoner/upsert.js
Knex postgres upsert
// Run with jest
import knex from 'knex'
import knexPgUpsert from '../knexPgUpsert'
const db = knex({ client: 'pg' })
const taps = [
{
@Whoaa512
Whoaa512 / client_main.js
Last active February 6, 2018 04:49
Meteor code to display user's facebook picture
Meteor.startup(function() {
Template.fb_pic.pic = function() {// helper function to display the pic on the page
var userProfile;
userProfile = Meteor.user().profile;
if(userProfile) { // logic to handle logged out state
return userProfile.picture;
}
};
});
@Whoaa512
Whoaa512 / MetricTypeDef.js
Created April 5, 2018 14:21
Example of GraphQL files for highlighting
const MetricTypeDefs = `
# Primitive types for conveying geometric data
type Metric {
count: Int!
}
# The input for sendMetrics
input MetricInput {
name: String!
points: [Float!]!
@Whoaa512
Whoaa512 / hygenTestHelpers.ts
Created November 14, 2019 21:35
Some helpers to test hygen
import fs from 'fs';
import path from 'path';
import execa from 'execa';
import { runner } from 'hygen';
import Logger from 'hygen/dist/logger';
export type ArgsObject = { [key: string]: string | boolean };
export const readFileString = (path: string) => fs.readFileSync(path, 'utf8');