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
{
"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",
@Avaq
Avaq / combinators.js
Last active May 1, 2024 09:38
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@benwyrosdick
benwyrosdick / Gemfile
Last active February 5, 2016 00:56
Password Protected Static Rack Site
gem 'rack'
@AllThingsSmitty
AllThingsSmitty / dimensions.js
Last active October 7, 2021 16:06
Every possible way (pretty much) to get the dimensions of any image on a web page with JavaScript
var myImg = document.querySelector('img'),
op = document.querySelector('output');
op.innerHTML = "Computed width: " +
getComputedStyle(myImg).getPropertyValue('width') +
'<br>' + 'img.width: ' +
myImg.width +
'<br>' + 'getAttribute(width): ' +
myImg.getAttribute('width') +
'<br>' + 'img.naturalWidth: ' +
@rcdilorenzo
rcdilorenzo / Gulpfile.js
Created April 10, 2015 01:00
An extremely readable yet powerful gulpfile that converts an angular app to dist folder that can be served as static assets in production while having sourcemaps and live reloading in the development environment. This gulpfile was a conversion from a stock grunt yeoman config.
var gulp = require('gulp');
var concat = require('gulp-concat');
var print = require('gulp-print');
var bowerFiles = require('main-bower-files');
var filter = require('gulp-filter');
var sass = require('gulp-sass');
var flatten = require('gulp-flatten');
var jsFilter = filter('**/*.js');
var cssFilter = filter('**/*.css');
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@rauchg
rauchg / effective-es6.md
Last active July 11, 2023 09:38
Writing ES6 today, effectively.

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.

The main tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on:

struct URL {
var scheme: String?
var user: String?
var password: String?
var host: String?
var port: Int?
var path: String?
var query: String?
var fragment: String?
@LeaVerou
LeaVerou / dabblet.css
Last active March 28, 2016 16:02
HSL clock
/**
* HSL clock
*/
height: 100%;
font: bold 5em/1 Helvetica Neue, sans-serif;
display: flex;
text-align: center;
align-items: center;
justify-content: center;
@pixelass
pixelass / Mandelbrot-in-SCSS.markdown
Last active October 21, 2015 14:49
Mandelbrot in SCSS

Mandelbrot in SCSS

The mandelbrot algorithm in SCSS. rendering the mandelbrot set in one element

<mandelbrot-set></mandelbrot-set>

A Live example