Skip to content

Instantly share code, notes, and snippets.

View ravinggenius's full-sized avatar
🤔
likely thinking

Thomas Ingram ravinggenius

🤔
likely thinking
View GitHub Profile

paragraph one

paragraph two

{
"name": "dual-cjs-mjs-package",
"version": "1.0.0",
"description": "A package that can be both imported as esm and as cjs",
"main": "entry",
"scripts": {
"build": "babel *.mjs **/*.mjs --out-dir ."
},
"devDependencies": {
"babel-cli": "^6.26.0",
@ravinggenius
ravinggenius / resize.sh
Last active September 6, 2017 04:25
Batch resize images with ImageMagick
# place this script in whatever directory you have your albums in
# each album is expected to have an `original` sub-directory where the full-size images actually are
# resized images will be placed in a sibling directory next to `original`
# USAGE
# $ ./resize.sh "2017-09-04 Some Album Name" 1600
# rename arguments
ALBUM=$1 # the name of the directory containing the album (may contain spaces, which is why everything is quoted below)
SIZE=$2 # used to size a bounding box into which images will be resized (aspect ratio will be preserved)
// node_modules/react-icons/lib/fa/500px.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
@ravinggenius
ravinggenius / dragon.js
Last active August 10, 2016 23:55 — forked from Jingram17/dragon.js
var slaying = true;
// A bit of new math magic to calculate the odds
// of hitting the dragon. We'll cover this soon!
var youHit;
var damageThisRound;
var totalDamage = 0;
do {
youHit = Math.floor(Math.random() * 2);
@ravinggenius
ravinggenius / README.md
Last active August 10, 2016 03:38
Exploration of allowed mutations in Rip

Mutations to the currently-initializing object will be allowed in Rip.

Notes

  • Methods defined at the class level are typically written as a simple reference assignment.
  • @ inside a class refers to the class' prototype property. Properties defined on this object become instance methods.
  • @ inside a method refers to the method's receiver. (self refers to the method itself.)
require 'parslet'
module Rip::Parser::Atoms
class Pattern < Parslet::Atoms::Base
attr_reader :pattern
def initialize(pattern)
super()
@pattern = pattern
end
@ravinggenius
ravinggenius / list.rip
Last active October 6, 2016 16:25
System.List.flatten
System.List = class<T> {
flatten = => {
-> (list<System.List>) {
switch (list.count) {
case (0) { list }
case (1) { [ self(list.head) ] }
else { [ ...self(list.head), ...self(list.tail) ] }
}
}
-> (object<System.Object>) { object }
@ravinggenius
ravinggenius / debug.rb
Created January 22, 2015 22:31
debug methods for rip
def self.debug(indent, label, context: nil, stack: nil)
body = if context && stack
[
"#{indent * 2} context",
*context_chain(indent * 4, context),
"#{indent * 2} stack",
*call_stack(indent * 4, stack)
]
elsif context
[