Skip to content

Instantly share code, notes, and snippets.

View brianswisher's full-sized avatar

Brian Swisher brianswisher

View GitHub Profile
window.location.hash.match(/user=([^&]+)/)
@brianswisher
brianswisher / deprecated-react-bootstrap-datetimepicker-0.0.16.sh
Created June 15, 2017 18:45
Deprecated, react-bootstrap-datetimepicker
warning @ warning.js:48
checkPropTypes @ ReactElementValidator.js:256
validatePropTypes @ ReactElementValidator.js:366
createElement @ ReactElementValidator.js:408
(anonymous) @ UnifiedTableFixed.jsx:738
(anonymous) @ index.js:2874
arrayMap @ index.js:1406
map @ index.js:6710
_renderColumns @ UnifiedTableFixed.jsx:733
(anonymous) @ UnifiedTableFixed.jsx:716
@brianswisher
brianswisher / get-nginx-v.md
Last active January 21, 2017 15:22
Get nginx version; command line
# cli
V=`nginx -v 2>&1 | tee`; echo "var re = /command not found/; var no = '$V'.match(re); if (no) { console.log('$V'.replace(re,'You don\'t have')) } else{ console.log('$V'.split('/').pop()) }" | node

# package
"scripts": {
    "nginx:v": "V=`nginx -v 2>&1 | tee`; echo \"var re = /command not found/; var no = '$V'.match(re); if (no) { console.log(unescape('$V'.replace(re,'You don%27t have'))) } else{ console.log('$V'.split('/').pop()) }\" | node"
}
@brianswisher
brianswisher / test-jenkins-chrome.sh
Created January 11, 2017 04:26
test:jenkins:chrome
npm run test:jenkins -- --browsers=Chrome
@brianswisher
brianswisher / console-agent.js
Created November 29, 2016 00:24
Console Agent
window.name=`
()=>{
const i=0
function step(num){window.name = window.name.split('i='+num).join('i='+(num+1))}
const commands=[
()=>{
step(0)
document.forms[0].username.value = 'username'
document.forms[0].password.value = 'password'
},
@brianswisher
brianswisher / equalizeTimezoneOffset.js
Created November 1, 2016 18:11
Equalize Timezone Offset
function equalizeTimezoneOffset (dateString) {
const parsedDate = new Date(dateString)
parsedDate.setMinutes(parsedDate.getMinutes() - parsedDate.getTimezoneOffset())
return parsedDate
}
@brianswisher
brianswisher / gettimezone.js
Created October 28, 2016 04:49
Get Timezone JavaScript
(() => {
const libs = [
'https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js'
].map((src) => {
return new Promise(resolve => {
const script = document.createElement("script"); script.src = src; script.async = false;
script.onload = () => {
resolve();
};
document.head.appendChild(script);
@brianswisher
brianswisher / bootstrap-3-media-queries.txt
Created August 25, 2016 22:49
Bootstrap 3 Media Queries
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {
@brianswisher
brianswisher / getToday.js
Last active May 23, 2016 17:13
GetTodayJS
function getToday() {
var today = new Date();
today.setHours(12);
return today.toISOString();
}
@brianswisher
brianswisher / get_bachelor.js
Last active January 12, 2016 22:35
Get Bachelor - return odd occurrence in array
(function(input){
function solution(A){
var input = (function(bachelor){
if (typeof A !== "object") throw new Error("A is not an object.");
if (typeof A.split === "function") throw new Error("A is not an array.");
if (!(A.length % 2)) throw new Error("A.length even.");
return {
squashCouples: function(lookup){
lookup = {};