Skip to content

Instantly share code, notes, and snippets.

Avatar

Ken Snyder kensnyder

View GitHub Profile
@kensnyder
kensnyder / package.json
Last active Jun 19, 2019
Minimal package.json file
View package.json
{
"name": "",
"description": "",
"version": "0.1.0",
"dependencies": {},
"devDependencies": {}
}
@kensnyder
kensnyder / 1) webpack.config.js
Created Oct 20, 2015
Using ng-annotate loader with Webpack + Angular 1.x + ES6 classes + Babel
View 1) webpack.config.js
module.exports = {
devtool: 'sourcemap',
context: __dirname,
entry: './entry.js',
output: {
filename: './dist/bundle.js'
},
module: {
loaders: [
// run babel first then ng-annotate
View jira-kanban.css
.adg3 .ghx-column h2 {
text-transform: none;
font-size: 13px;
color: #2e2e2e
}
.adg3 .ghx-column-headers .ghx-qty {
background-color: #18cb3b;
color: white;
width: 20px;
height: 20px;
View MacBook Pro Late 2013 with PCIe SSD Results.txt
Benchmarking against 10 iteration(s):
--- 1.2MB jpg file ---
0.298s - data uri base64_encode()
0.701s - data uri urlencode()
0.702s - data uri rawurlencode()
0.045s - temp file
--- 2.5MB jpg file ---
0.597s - data uri base64_encode()
View angular.filters.nl2br.js
/*
# Usage in html template:
"xxx | nl2br"
<div ng-bind-html=" YourString | nl2br "></div>
or:
View castObject.php
<?php
$foo = castObject($bar, '\\My\\FooObject');
function castObject($obj, $toClass) {
if (is_callable("$toClass::__cast")) {
return call_user_func("$toClass::__cast", $obj);
}
if ($obj instanceof $toClass) {
return $obj;
@kensnyder
kensnyder / themefile.css
Created May 8, 2013
Example of hiding the image in the body of a Right Intel post
View themefile.css
.ri-image-wrapper {
display: none !important;
}
@kensnyder
kensnyder / repeated-ids.js
Created Feb 6, 2013
Find all repeated ids in a document
View repeated-ids.js
var ids = {};
var repeats = [];
document.body.innerHTML.replace(/ id="(.+?)"/g, function($0, $1) {
if (ids[$1]) repeats.push($1);
ids[$1] = true;
});
console.log(repeats);
// output
["carouselitem-2887", "carouselitem-2850", "slider-2887", "slider-2850", "carouselitem-2887", "carouselitem-2850", "carouselitem-2843", "slider-2887", "slider-2850", "slider-2843", "carouselitem-2887", "carouselitem-2850", "carouselitem-2843", "slider-2887", "slider-2850", "slider-2843", "carouselitem-2918", "carouselitem-2924", "carouselitem-2923", "carouselitem-2922", "carouselitem-2919", "carouselitem-2917", "carouselitem-2916", "carouselitem-2913", "carouselitem-2912", "carouselitem-2911", "carouselitem-2909", "carouselitem-2898", "carouselitem-2897", "carouselitem-2896", "carouselitem-2895", "carouselitem-2892", "carouselitem-2887", "carouselitem-2882", "carouselitem-2881", "carouselitem-2874", "slider-2918", "slider-2924", "slider-2923", "slider-2922", "slider-2919", "slider-2917", "slider-2916", "slider-2913", "sli
@kensnyder
kensnyder / casper-qsa.js
Last active Dec 10, 2015
Quick and Dirty jQuery-like function for Casper
View casper-qsa.js
function qsa(sel, each) {
return [].map.call(document.querySelectorAll(sel) || [], each || function(el) {return el});
}
// usage:
qsa('a[href*="/reports/"], .legend', function(el) {
el.style.visibility = 'hidden';
});
@kensnyder
kensnyder / 0_reuse_code.js
Created Nov 12, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.