Gist is no longer being updated, view repository at https://github.com/jgornick/mdashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
truncate /tmp/ping.log -s 0 | |
while true; do | |
if ! ping -I ppp0 -s 8 -c 1 8.8.8.8 &> /dev/null; then | |
date --rfc-3339=ns | tee -a /tmp/ping.log &> /dev/null | |
fi | |
sleep 30 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($, window, document, undefined) { | |
'use strict'; | |
var | |
pluginName = 'maskInput', | |
defaults = { | |
// The masked character when the field is blurred. | |
character: '%u25CF', | |
// Convert the element from password to text to bypass browser password persistence. | |
bypassPassword: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Capture files in path and register | |
shell: > | |
ls -1 /path/to/files | |
register: files | |
- name: Remove files except specified | |
file: | |
path: "/path/to/files/{{ item }}" | |
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timestamp from 'mongoose-timestamp'; | |
export default function(mongoose) { | |
let | |
Schema = mongoose.Schema; | |
/** | |
* @type {Schema} | |
*/ | |
let RequireSchema = new Schema({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -name "*sublime-project" -exec subl --project {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gulp from 'gulp'; | |
import through from 'through2'; | |
gulp | |
.src('/tmp/file.txt') | |
.pipe(through.obj(function(file, encoding, done) { | |
if (file.isBuffer()) { | |
this.push(file.contents); | |
done(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
static getType() { | |
return 'foo'; | |
} | |
getType() { | |
return this.constructor.getType(); | |
} | |
constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// With this example, the error that is thrown outside of the stream is actually caught inside the stream.on('error') handler. | |
var | |
fs = require('fs'), | |
csv = require('fast-csv'); | |
function throwError() { | |
throw new Error('implicit error'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Accepted formats are 0-3 alpha, 9 digits, and 1-3 alpha-numeric with or without spaces and dashes: | |
# * AAA-000-00-0000-AAA | |
# | |
# http://survivinghealthinsurance.com/2010/medicare-id-numbers-suffixes-and-prefixes/ | |
/^([a-z]{0,3})[-\s]?(\d{3})[-\s]?(\d{2})[-\s]?(\d{4})[-\s]?([0-9a-z]{1,3})$/i |