Skip to content

Instantly share code, notes, and snippets.

Daryl Roberts sorahn

Block or report user

Report or block sorahn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@algesten
algesten / start-tmux.sh
Created May 14, 2017
start tmux in bashrc
View start-tmux.sh
# TMUX
# test if tmux is available
if type tmux >/dev/null 2>&1; then
# if not inside a tmux session, and if no session is started, start a new session
# I only want this on my mac laptop.
if [ -z "$TMUX" -a `uname` == Darwin ]; then
# attach to session "martin" if there
exec tmux -2 -f ~/.tmux-osx.conf new-session -A -s martin
fi
fi
@lydell
lydell / .eslintrc.js
Last active Sep 22, 2017
Generates .flowconfig regexps that ignores everything in `node_modules/` except the given modules.
View .eslintrc.js
module.exports = {
extends: [
"strict",
"prettier",
],
parserOptions: {
ecmaVersion: 2016,
},
plugins: ["prettier"],
rules: {
View es6-feature-detection.js
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@paulirish
paulirish / what-forces-layout.md
Last active Oct 20, 2019
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
View modal-with-react-motion.js
import React from 'react';
import { TransitionSpring, presets } from 'react-motion';
export default class Modal {
static propTypes = {
shown: React.PropTypes.bool,
onClose: React.PropTypes.func
};
@ImJasonH
ImJasonH / markdown.css
Last active Oct 19, 2019
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@sorahn
sorahn / side-shadow.scss
Last active Aug 29, 2015
Generate an "inset" shadow on a single side of a div.
View side-shadow.scss
//
// @author Daryl Roberts
// @license MIT
// @url https://gist.github.com/sorahn/7915cae6c820e351158f
//
@mixin side-shadow($shadow, $side, $base-size: 50px) {
// If you need to make shadows larger than 50px, you can
// override the base size.
@sebmarkbage
sebmarkbage / Enhance.js
Last active Oct 19, 2019
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@benhuson
benhuson / ios7-safari-height-issue
Last active Apr 22, 2016
Fix iOS 7 iPad Safari Landscape innerHeight/outerHeight layout issue
View ios7-safari-height-issue
/**
* Add ipad IOS7 Classes
* Allows us to temporariliy try to fix the slight scroll 100% hack.
* http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue
*/
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('html').addClass('ipad ios7');
}
/**
@aseemk
aseemk / coffeescript-updates.md
Last active Dec 2, 2017
CoffeeScript upcoming changes.
View coffeescript-updates.md

CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement.

Parentheses-free chaining

https://github.com/jashkenas/coffee-script/pull/3263

Years of being wished for, finally granted!

You can’t perform that action at this time.