Skip to content

Instantly share code, notes, and snippets.

View jordaaash's full-sized avatar
🌴
Not on vacation, I just love palm trees

Jordan jordaaash

🌴
Not on vacation, I just love palm trees
View GitHub Profile
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#First released as C++ program by Hiroyuki Tsutsumi as part of the free software suite “Beer”
#I thought porting it to Python could be both a challenge and useful
from sys import argv, exit, getsizeof
from struct import pack_into, unpack_from
def ceil4(n):
@jordaaash
jordaaash / cover.styl
Last active May 23, 2017 08:10
Cross-browser object-fit: cover mixin
cover(width = inherit, height = inherit, min-width = 100%, min-height = 100%)
// Chrome, Safari
@media screen and (-webkit-min-device-pixel-ratio: 0)
object-fit cover
height height
width width
// Firefox
@-moz-document url-prefix()
&
object-fit cover
'use strict';
var React = require('react');
var P = React.PropTypes;
var PureRenderMixin = require('react/lib/ReactComponentWithPureRenderMixin');
var Waypoints;
if (typeof window !== 'undefined') {
Waypoints = require('waypoints/lib/noframework.waypoints');
Waypoints.Inview = require('waypoints/lib/shortcuts/inview');
irb(main):007:0> class Numeric
irb(main):008:1> def reverse
irb(main):009:2> self.class
irb(main):010:2> end
irb(main):011:1> end
=> :reverse
irb(main):012:0> 2.reverse
=> Fixnum
@jordaaash
jordaaash / resize_mixin.js
Created August 26, 2015 19:17
Resize mixin for responsive components
'use strict';
var ResizeMixin, raf;
if (typeof window === 'undefined') {
ResizeMixin = {};
}
else {
raf = require('raf');
ResizeMixin = {
#!/usr/bin/env bash
for sha in `git rev-list HEAD..$1`; do
clear
git show --color $sha | less -XE
echo
while true; do
read -p "Do you wish to use this commit (y/n/q) ? " answer
case $answer in
[Yy]* ) git cherry-pick $sha;;
@jordaaash
jordaaash / esnextbin.md
Created February 14, 2016 02:46
esnextbin sketch
@jordaaash
jordaaash / public_path.js
Created March 8, 2016 21:23
Deterministic filename-based CDN sharding
'use strict';
var publicPath = require('./static_path')(process.env.PUBLIC_PATH); // e.g. PUBLIC_PATH=https://static%d.domain.com/
module.exports = publicPath;
@jordaaash
jordaaash / DecoratorPattern.js
Created October 18, 2016 00:29
Decorator Pattern with generics in Flow (not working)
// @flow
class SuperClass {
something () {
}
}
class SubClass extends SuperClass {
}
@jordaaash
jordaaash / bluebird.js
Last active February 15, 2017 21:52 — forked from lorenzodallavecchia/bluebird-zone.js
Patch for making the Bluebird library aware of Zone.js
'use strict';
import Promise from 'bluebird';
import {
zonifyCall,
zonifyCatch,
zonifyCoroutine,
zonifyFirst,
zonifyLast,
zonifyMiddle,