Skip to content

Instantly share code, notes, and snippets.

View jasonbyrne's full-sized avatar

Jason Byrne jasonbyrne

View GitHub Profile
@jasonbyrne
jasonbyrne / timing.js
Last active August 29, 2015 14:05
Better Timing Management
/**
* Created by jasonbyrne on 8/30/14.
*/
window.JCB = window.JCB || {};
JCB.Timing = (function(){
// Self
var me = {};
// Private Properties
@jasonbyrne
jasonbyrne / xYourHeart.js
Last active August 29, 2015 14:06
Simple promise maker for browser JavaScript or Node.JS
/**
* Created by jasonbyrne on 9/2/14.
*/
var xYourHeart = (function(){
// Self-reference
var xYourHeart = {
STATUS: {
PENDING: 0,
FAILURE: -1,
var HTTP_STATUS = {
'OK': 200,
'CREATED': 201,
'ACCEPTED': 202,
'NON_AUTHORITATIVE': 203,
'NO_CONTENT': 204,
'RESET': 205,
'PARTIAL_CONTENT': 206,
'MULTI_STATUS': 207,
'ALREADY_REPORTED': 208,
/**
* Imperavi Redactor Plugin for Embedding Tweets
* for version >= 9.1
*
* https://gist.github.com/jasonbyrne/6e96a907c781e90e0dbf
*
* @author Jason Byrne <[email protected]>
* @version 0.5.1
*
* @forked https://gist.github.com/chekalskiy/7438084
@jasonbyrne
jasonbyrne / summernote-pastclean.js
Created October 14, 2015 18:21
Plugin for Summernote WYSIWYG editor that cleans up the pasted in content
/**
* Summernote PasteClean
*
* This is a plugin for Summernote (www.summernote.org) WYSIWYG editor.
* It will clean up the content your editors may paste in for unknown sources
* into your CMS. It strips Word special characters, style attributes, script
* tags, and other annoyances so that the content can be clean HTML with
* no unknown hitchhiking scripts or styles.
*
* @author Jason Byrne, FloSports <[email protected]>
@jasonbyrne
jasonbyrne / sumernote-fixedtoolbar.js
Created October 15, 2015 21:39
Plugin for Summernote to keep the toolbar fixed to the top of the screen as you scroll.
/**
* Summernote Fixed Toolbar
*
* This is a plugin for Summernote (www.summernote.org) WYSIWYG editor.
* It will keep the toolbar fixed to the top of the screen as you scroll.
*
* @author Jason Byrne, FloSports <[email protected]>
*
*/
@jasonbyrne
jasonbyrne / q.js
Created October 30, 2015 04:06
Untested queue
var q = (function() {
var me = this,
_callbacks = [],
_index = -1,
_nonePending = true;
me.then = function(callback) {
// Add this to the queue
_callbacks.push(callback);
@jasonbyrne
jasonbyrne / datatable.ts
Last active October 13, 2023 21:44
DataTable in TypeScript that can be sorted and filtered and what not
namespace JCB {
export enum SortStyle {
String,
Numeric,
CaseSensitiveString
}
export enum SortOrder {
ASC,
@jasonbyrne
jasonbyrne / bandwidth.sh
Created April 4, 2017 02:01
Very basic bash script to parse the log file for OpenVPN bandwidth by user
#!/bin/bash
input_file=/var/log/openvpn/status.log
echo ""
echo "Reading $input_file"
echo ""
while read line; do
if [[ "$line" = *,* ]]; then
IFS=',' read -ra fields <<< "$line" #Convert string to array
@jasonbyrne
jasonbyrne / temp-upload.sh
Created April 7, 2017 05:03
Upload a file to to file.io with an expiration (requires jq to be installed)
#!/bin/bash
if [[ ! $1 ]]; then
echo "No file provided"
exit
fi
if [ ! -f "$1" ]; then
echo "File does not exist"
echo "$1"
echo ""