Skip to content

Instantly share code, notes, and snippets.

@branneman
branneman / count-lint-errors.js
Last active July 31, 2023 17:59
Group-By-Count ESLint errors
// :: (String, String) => String
const spawn = require('child_process').spawnSync;
// :: String => [String]
const getRules = raw => raw
.split('\n')
.map(line => line.trim())
.filter(line => !!line)
.filter(line => line[0] !== '/' && line[0] !== '✖')
.map(line => line.match(/[a-z-]+$/)[0]);
@just-boris
just-boris / index.js
Last active April 10, 2019 20:59
Gulp wrap pipe
/**
* Wrap gulp streams into fail-safe function for better error reporting
* Usage:
* gulp.task('less', wrapPipe(function(success, error) {
* return gulp.src('less/*.less')
* .pipe(less().on('error', error))
* .pipe(gulp.dest('app/css'));
* }));
*/
@attilah
attilah / cleanData override
Created August 1, 2014 21:26
Angular 1.2+, jQuery 2.1+, jQuery UI 1.x+ include order
If you're using Angular 1.2+, jQuery 2.1+, jQuery UI 1.x+ together, you can easily get a weird error like this:
TypeError: undefined is not a function
at replaceWith (http://myapp.com/app/bower_components/angular/angular.js:7289:26)
at applyDirectivesToNode (http://myapp.com/app/bower_components/angular/angular.js:6518:13)
at compileNodes (http://myapp.com/app/bower_components/angular/angular.js:6167:15)
at compileNodes (http://myapp.com/app/bower_components/angular/angular.js:6179:15)
at compile (http://myapp.com/app/bower_components/angular/angular.js:6107:15)
at http://myapp.com/app/bower_components/angular/angular.js:1506:11
at Scope.$eval (http://myapp.com/app/bower_components/angular/angular.js:12903:28)
@paulirish
paulirish / gist:5558557
Last active April 18, 2024 14:32
a brief history of detecting local storage

A timeline of the last four years of detecting good old window.localStorage.


Jan Lenhart, bless his heart contributed the first patch for support:

October 2009: 5059daa

@jimothyGator
jimothyGator / README.md
Last active April 25, 2024 18:00
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@crofty
crofty / leaflet-google.js
Created March 25, 2012 15:07
Leaflet plugin that enables the use of Google Map tiles - http://matchingnotes.com/using-google-map-tiles-with-leaflet
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
@insin
insin / index.html
Last active February 8, 2024 15:14
Export a <table> to Excel - http://bl.ocks.org/insin/1031969
<!DOCTYPE html>
<html>
<head>
<title>tableToExcel Demo</title>
<script src="tableToExcel.js"></script>
</head>
<body>
<h1>tableToExcel Demo</h1>
<p>Exporting the W3C Example Table</p>
function CroppedImage(image,sx,sy,sw,sh){
this.image = image;
this.sx = sx;
this.sy = sy;
this.sw = sw;
this.sh = sh;
}
CroppedImage.prototype.draw = function(context,x,y){
context.drawImage(this.image, this.sx, this.sy, this.sw, this.sh, x, y, this.sw, this.sh)