Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@cicorias
cicorias / issue_template
Created February 28, 2016 16:26
Issue template example
### My Environment
- [ ] Windows 7 or below (not truly supported due to EOL)
- [ ] Windows 8
- [ ] Windows 8.1
- [ ] Windows 10
- [ ] Windows 10 IoT Core
- [ ] Windows Server 2012
- [ ] Windows Server 2012 R2
- [ ] Windows Server 2016
var wrappers = require("pouchdb-wrappers");
var noops = {};
// also add all the other methods
"get allDocs getAttachment info revsDiff put post".split(" ")).forEach(function (name) {
noops[name] = function (orig) {return orig(); };
});
wrappers.installWrapperMethods(db, noops);
@cicorias
cicorias / sublime.sh
Created March 1, 2016 13:16
sublime from command line
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
@cicorias
cicorias / inherit.js
Created March 1, 2016 15:55
an inherit using lodash - stolen from here; https://github.com/lodash/lodash/issues/663
_.mixin({
'inherit': function(child, base, props) {
child.prototype = _.create(base.prototype, _.assign({
'_super': base.prototype,
'constructor': child
}, props));
return child;
}
});
@cicorias
cicorias / benchmark.js
Created March 2, 2016 04:26
benchmark of custom indexof vs. a map
'use strict';
// var fast = require('fast.js');
var Benchmark = require('benchmark');
function generateString(length) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#$%^&*()-_+=!@~<>?/.,[]}{\|}";
for (var i = 0; i < length; i++) {
@cicorias
cicorias / startCollab.sh
Last active March 3, 2016 19:24
Morning Routine - Mac OS X startup apps
#!/bin/bash
open -j -a 'Microsoft Lync'
open -j -a 'Slack'
open -j -a 'Skype'
open -k -a 'Microsoft Outlook'
open -j -a 'Quip'
@cicorias
cicorias / appify
Created March 3, 2016 13:10 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@cicorias
cicorias / regex-string-whitelist.js
Created March 6, 2016 18:14 — forked from steveosoule/regex-string-whitelist.js
JavaScript Regular Expression Whitelist for String
// in the regex, the carrot(^) negates the match, so if the stringToReplace contains something that is not a-z or 0-9 it will be replaced
// In this case the desired string will only be alpha numeric characters, stripping out spaces and symbols
// Help from: http://stackoverflow.com/questions/4374822/javascript-regexp-remove-all-special-characters
var desired = stringToReplace.replace(/[^a-zA-Z0-9]/gi, '')
function doHash(str, seed) {
var m = 0x5bd1e995;
var r = 24;
var h = seed ^ str.length;
var length = str.length;
var currentIndex = 0;
while (length >= 4) {
var k = UInt32(str, currentIndex);