Skip to content

Instantly share code, notes, and snippets.

@bolasblack
bolasblack / cR.js
Last active May 18, 2017 07:56
[dot chain syntax for ramda.js]
import R from 'ramda'
class CR {
constructor(fn) {
this.runCR = (fn || R.identity)
}
}
R.keys(R).forEach(method => {
CR.prototype[method] = function() {
var rfn = arguments.length ? R[method].apply(null, arguments) : R[method]
@bolasblack
bolasblack / nodejs unlimited console.log.js
Last active October 5, 2018 04:45
nodejs unlimited console.log
const util = require('util')
module.exports.global = () => {
util.inspect.defaultOptions.maxArrayLength = null
util.inspect.defaultOptions.depth = null
}
module.exports.consoleJson = () =>
console.json = (...args) =>
console.log.apply(console, args.map(arg =>
@bolasblack
bolasblack / keymap_hhkb.c
Last active November 4, 2017 00:23
tmk_keyboard keymap
/*
* HHKB Layout
*/
// Remember to uncomment `KEYMAP_SECTION_ENABLE = yes` in Makefile
#include "keymap_common.h"
#ifdef KEYMAP_SECTION_ENABLE
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
@bolasblack
bolasblack / report-boss.js
Last active June 5, 2017 07:49
[report boss]
const groups = $('#data-table > tbody').map((index, elem) => ({
title: $(elem).find('.group-title').text(),
entries: $(elem).find('.reports-table-children > tbody > tr').map((index, elem) => ({
title: $.trim($(elem).find('.col-title').text()),
time: parseFloat($.trim($(elem).find('.col-total').text()), 10)
})).toArray()
})).toArray()
groups.forEach(group => {
const groupedEntries = group.entries.reduce((memo, entry) => {
memo[entry.time > 1 ? 'isolate' : 'merge'].push(entry)
@bolasblack
bolasblack / GuideColor.swift
Last active May 26, 2016 02:26
Colors from iOS Human Interface Guidelines
import UIKit
// Color from: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/ColorImagesText.html
class GuideColor {
static let cyan = UIColor(red: 90/255, green: 200/255, blue: 250/255, alpha: 1)
static let yellow = UIColor(red: 255/255, green: 204/255, blue: 0/255, alpha: 1)
static let orange = UIColor(red: 255/255, green: 149/255, blue: 0/255, alpha: 1)
static let pink = UIColor(red: 255/255, green: 45/255, blue: 85/255, alpha: 1)
static let blue = UIColor(red: 0, green: 122/255, blue: 255/255, alpha: 1)
static let green = UIColor(red: 76/255, green: 217/255, blue: 100/255, alpha: 1)
@bolasblack
bolasblack / .gitignore
Created November 13, 2015 12:51
selectize editable tag
node_modules
index.js
@bolasblack
bolasblack / export.scpt
Last active September 10, 2018 09:14
Export OS X Reminder
on format_time(currTime as date)
set stamp to the time of currTime
set h to text -2 thru -1 of ("00" & (stamp div (60 * 60)))
set m to text -2 thru -1 of ("00" & (stamp - (60 * 60) * h) div 60)
set s to text -2 thru -1 of ("00" & (stamp - ((60 * 60) * h + 60 * m)))
return h & ":" & m & ":" & s
end format_time
-- from http://henrysmac.org/blog/2014/1/4/formatting-short-dates-in-applescript.html
on format_date(currTime as date)
@bolasblack
bolasblack / Vagrantfile
Created June 24, 2015 09:18
Vagrantfile to auto install nodejs
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@bolasblack
bolasblack / AppDelegate.m
Last active August 29, 2015 14:20
React-native with coffee
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"