Skip to content

Instantly share code, notes, and snippets.

@mikesherov
mikesherov / gist:65f6e122e5fe2139171c
Created July 17, 2014 15:40
CSP violation with chrome-extension as source-file
{"document-uri":"https://www.behance.net/joblist","referrer":"https://www.behance.net/Ginz","violated-directive":"img-src https: data: safari-extension: chrome-extension: http://*.rackcdn.com http://huaban.com","original-policy":"connect-src *;frame-src *;img-src https: data: safari-extension: chrome-extension: http://*.rackcdn.com http://huaban.com; report-uri /v2/log/csp","blocked-uri":"http://www.amazon.com","source-file":"chrome-extension://dbpfafcplnjmakknnonpegphpmpmhjhj","line-number":215,"column-number":13,"status-code":0}
@mikesherov
mikesherov / gist:1f38bdc8a499b47dbb40
Created May 21, 2014 21:27
Using grasp to upgrade jQuery on your site
// converts $.fn.live to $.on
grasp "call[callee.prop=#live][callee.object=call]" -R "\$(document.body).on({{.args:first}}, {{.callee.object.args:first}}, {{.args:last}})"
onFocus: function( element, onFocus ) {
var fn = function( event ){
if( !event.originalEvent ) {
return;
}
element.unbind( "focus", fn );
onFocus();
};
element.bind( "focus", fn )[ 0 ].focus();
onFocus: function( element, onFocus ) {
element.bind( "focus", function( event ){
if( !event.originalEvent ) {
return;
}
element.unbind( "focus" );
onFocus();
})[ 0 ].focus();
},
@mikesherov
mikesherov / grunt.md
Created April 25, 2012 12:56
getting grunt to work on windows with cygwin and git

Getting grunt to work with Cygwin and git on Windows is a bit difficult considering the cygwin package that is installed by git has an outdated version of node running on it (at least that was the case in Windows XP). There are several issues to work through:

  1. Cygwin by default installs an old version of node, this was only the case in my Windows XP machine.
  2. Open Cygwin shell
  3. which node tells you where the executable is
  4. node --version tells you if it's old
  5. cd to the directory listed by which node
  6. mv node.exe node.exe.bak
  7. download node from nodejs.org and install it
  8. Node installed through installer MIGHT not update PATH to point to correct version of node installed normally.
@mikesherov
mikesherov / gist:1465088
Created December 12, 2011 05:13
jQuery JSHint specific files
var jshint = require("./lib/jshint").JSHINT,
reader = require("fs").readFileSync,
files = [
"ajax",
"ajax/jsonp",
"ajax/script",
"ajax/xhr",
"attributes",
"callbacks",
"core",
@mikesherov
mikesherov / LICENSE.txt
Created June 7, 2011 12:17 — forked from jed/LICENSE.txt
map properties for arrays and objects
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mike Sherov <http://mike.sherov.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mikesherov
mikesherov / LICENSE.txt
Created June 6, 2011 22:12 — forked from 140bytes/LICENSE.txt
140byt.es -- bbCodifier
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mike Sherov <http://mike.sherov.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mikesherov
mikesherov / LICENSE.txt
Created June 4, 2011 22:34 — forked from bytespider/LICENSE.txt
140byt.es -- convert string to array of UTF-8 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mikesherov
mikesherov / LICENSE.txt
Created June 4, 2011 19:09 — forked from bytespider/LICENSE.txt
140byt.es -- convert string to array of UTF-8 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE