Skip to content

Instantly share code, notes, and snippets.

View CrocoDillon's full-sized avatar

Dillon de Voor CrocoDillon

View GitHub Profile
if (typeof Promise === 'undefined') {
require.ensure([], (require) => {
require('imports?this=>window!es6-promise')
})
}
if (typeof fetch === 'undefined') {
require.ensure([], (require) => {
require('imports?self=>window!whatwg-fetch')
})
@cahnory
cahnory / middleware.js
Created December 21, 2015 15:55
koa-webpack-middleware
import connect from 'koa-connect';
import compose from 'koa-compose';
import webpack from 'webpack';
import webpackDev from 'webpack-dev-middleware';
import webpackHot from 'webpack-hot-middleware';
export default function (config = {}) {
let compiler = webpack(config);
return compose([
@paulirish
paulirish / what-forces-layout.md
Last active May 9, 2024 07:00
What forces layout/reflow. The comprehensive list.

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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@kopiro
kopiro / sudoku-solver-with-bt.js
Created May 11, 2015 20:45
Sudoku solver with backtracking
function getp(puzzle, x, y) {
var hash = {};
for (var u = 0; u < 9; u++) hash[ puzzle[y][u] ] = 1;
for (var u = 0; u < 9; u++) hash[ puzzle[u][x] ] = 1;
for (var u = 0; u < 9; u++) hash[ puzzle[ 3*((y/3)|0) + ((u/3)|0) ][ 3*((x/3)|0) + (u%3) ] ] = 1;
var poss = [];
for (var i = 1; i <= 9; i++) if (!(i in hash)) poss.push(i);
return poss;
}
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
@razwan
razwan / _baseline.scss
Created April 14, 2014 16:20
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
<?php
// you can't just get this as JSON in the first place, can you ...?
$xml = simplexml_load_file( "http://readability.com/christopherburton/latest/feed" );
$json = json_encode( $xml );
$array = json_decode( $json,TRUE );
$items = $array['channel']['item'];
// we're doing this now so we can sanitize the data without requiring a second loop
// (substitute your actual DB credentials)
$DB = new mysqli( DB_HOST,DB_USER,DB_PASS,DB_NAME );
@cheeaun
cheeaun / js-error-logging-services.md
Last active December 10, 2023 13:04
JavaScript error logging services
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@bubbleheadinc
bubbleheadinc / gist:5725438
Created June 6, 2013 22:15
Mixin loop to spit out span classes based on # of grid columns for JustifyGrid.com SCSS
@mixin grid-spans($col-span){
@while $col-span > 0{
.grid-span-#{$col-span}{
width: grid-span($col-span);
}
$col-span: $col-span - 1;
}
}