Skip to content

Instantly share code, notes, and snippets.

@piercemoore
piercemoore / get-safari-urls.js
Created October 14, 2017 21:55
Automator script to get URLs of all tabs in a safari window
var Chrome = Application('Google Chrome');
var Safari = Application('Safari');
Safari.includeStandardAdditions = true;
Chrome.includeStandardAdditions = true;
var urls = [];
Safari.windows[0].tabs().forEach(function(tab) {
console.log(tab.url())
@piercemoore
piercemoore / NerdShortcuts.sh
Last active December 17, 2015 17:09
Aliases for Shortcuts in MongoDB/Redis
### The commands
# Show all collections and the number of documents in each
mongo zngine_dev --eval "printjson(db.getCollectionNames().forEach(function(coll){printjson(coll+\"-\"+db[coll].count())}))"
# Drop all collections and remove all indexes from mongo
mongo zngine_dev --eval "db.getCollectionNames().forEach( function(coll) { if(coll!=\"system.indexes\") { db[coll].drop(); db[coll].dropIndexes(); } } )"
# Count all Redis keys
redis-cli keys "*" | wc -l
# Clear all Redis keys
redis-cli flushall
db.Page.insert({
name : 'page-X',
title : 'Title Here',
sections : [
{
name : 'hero-1',
content : 'all content here blah blah'
},
{
name : 'hero-2,
@piercemoore
piercemoore / TeamHexColors.html
Created May 19, 2013 23:31
Hex color codes for all USA pro sports teams
MLB
Arizona Diamondbacks: #C51230 (red) | #241E20 (black)
Atlanta Braves: #01487E (blue) | #D60D39 (red)
Baltimore Orioles: #020001 (black) | #DF4601 (orange)
Boston Red Sox: #0E2B55 (blue) | #BD3039 (red)
Chicago Cubs: #0E3386 (blue) | #D12325 (red)
Chicago White Sox: #000000 (black) | #555B66 (dark gray) | #DCDDDF (silver)
Cincinnati Reds: #EB184B (red) | #FFFFFF (white)
Cleveland Indians: #023465 (dark blue) | #EE113D (red)
Colorado Rockies: #000000 (black) | #333366 (purple) | #CACDCD (light gray)
@piercemoore
piercemoore / fontawesome.display.js
Last active December 16, 2015 15:49
PHP array of all the icons in FontAwesome's icon font, and a loop to display them in a table.
var html = '';
icons.forEach(function(icon) {
html += '<tr><td><code>icon-' + icon + '</code></td><td><i class="icon-' + icon + '"></i></td></tr>';
});
$("#icon_table").html( html );
@piercemoore
piercemoore / zurb_foundicons.display.php
Last active December 16, 2015 15:49
PHP array of all the symbols in Zurb's Foundation Framework icon fonts and the function to display all of them
<?php
$sets = ['access' => ['wheelchair','speaker','fontsize','eject','view-mode','eyeball','asl','person','question','adult','child','glasses','cc','blind','braille','iphone-home','w3c','css','key','hearing-impaired','male','female','network','guidedog','universal-access','elevator'], 'social' => [ 'thumb-up','thumb-down','rss','facebook','twitter','pinterest','github','path','linkedin','dribbble','stumble-upon','behance','reddit','google-plus','youtube','vimeo','flickr','slideshare','picassa','skype','steam','instagram','foursquare','delicious','chat','torso','tumblr','video-chat','digg','wordpress'], 'general' => [ 'settings','heart','star','plus','minus','checkmark','remove','mail','calendar','page','tools','globe','home','quote','people','monitor','laptop','phone','cloud','error','right-arrow','left-arrow','up-arrow','down-arrow','trash','add-doc','edit','lock','unlock','refresh','paper-clip','video','photo','graph','idea','mic','cart','address-book','compass','flag','location','clock','folder','
@piercemoore
piercemoore / _foundicons.scss
Created April 25, 2013 06:21
Wrap all foundation's icon fonts into one file include
// Let's wrap all these into the same file :D
@mixin i-class($name,$pua) {
.#{$classPrefix}#{$name}:before {
content: "\f#{$pua}";
}
}
@mixin ie-class($name,$pua) {
.#{$classPrefix}#{$name} {
@piercemoore
piercemoore / MongoShellScripts.js
Last active December 15, 2015 16:09
MongoDB Shell Scripts to make your doggone life easier
/**
* Links and such
*
* http://docs.mongodb.org/manual/reference/mongo-shell/
* http://docs.mongodb.org/manual/reference/javascript/
* http://docs.mongodb.org/manual/reference/meta-query-operators/
*/
/**
* Show the names of all collections and the number of documents in each of them.
@piercemoore
piercemoore / UnderscoreMixins.js
Last active December 15, 2015 15:49
Compilation of Awesome and Mega-Useful Underscore.js Mixins
/**
* All of the following Mixins are credited to their original authors, I DID NOT write ANY of these awesome things
* unless I specifically commented immediately preceding the mixin.
*/
// underscore-pickrandom.js
// (c) 2012 Simon Kågedal Reimer
// This file is freely distributable under the MIT license.
// https://gist.github.com/skagedal/1709989
@piercemoore
piercemoore / Nil.sublime-theme
Created March 21, 2013 21:28
Compressed sidebar modification for Sublime Text 2 theme "Nil". This modification reduces the indentation, row padding, and font sizes for the Nil theme to make it easier to work with large numbers of files.
[
// Nil theme for Sublime Text 2
// https://github.com/nilium/st2-nil-theme
// TABS
// ==========================================================
// - Tabset