Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Byrne jasonbyrne

View GitHub Profile
@jasonbyrne
jasonbyrne / timing.js
Last active Aug 29, 2015
Better Timing Management
View timing.js
/**
* 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 Aug 29, 2015
Simple promise maker for browser JavaScript or Node.JS
View xYourHeart.js
/**
* Created by jasonbyrne on 9/2/14.
*/
var xYourHeart = (function(){
// Self-reference
var xYourHeart = {
STATUS: {
PENDING: 0,
FAILURE: -1,
View httpStatusCodes.js
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,
View tweets.redactor.js
/**
* Imperavi Redactor Plugin for Embedding Tweets
* for version >= 9.1
*
* https://gist.github.com/jasonbyrne/6e96a907c781e90e0dbf
*
* @author Jason Byrne <jason.byrne@flocasts.com>
* @version 0.5.1
*
* @forked https://gist.github.com/chekalskiy/7438084
@jasonbyrne
jasonbyrne / summernote-pastclean.js
Created Oct 14, 2015
Plugin for Summernote WYSIWYG editor that cleans up the pasted in content
View summernote-pastclean.js
/**
* 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 <jason.byrne@flosports.tv>
@jasonbyrne
jasonbyrne / sumernote-fixedtoolbar.js
Created Oct 15, 2015
Plugin for Summernote to keep the toolbar fixed to the top of the screen as you scroll.
View sumernote-fixedtoolbar.js
/**
* 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 <jason.byrne@flosports.tv>
*
*/
@jasonbyrne
jasonbyrne / q.js
Created Oct 30, 2015
Untested queue
View q.js
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 Oct 14, 2020
DataTable in TypeScript that can be sorted and filtered and what not
View datatable.ts
namespace JCB {
export enum SortStyle {
String,
Numeric,
CaseSensitiveString
}
export enum SortOrder {
ASC,
@jasonbyrne
jasonbyrne / bandwidth.sh
Created Apr 4, 2017
Very basic bash script to parse the log file for OpenVPN bandwidth by user
View bandwidth.sh
#!/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 Apr 7, 2017
Upload a file to to file.io with an expiration (requires jq to be installed)
View temp-upload.sh
#!/bin/bash
if [[ ! $1 ]]; then
echo "No file provided"
exit
fi
if [ ! -f "$1" ]; then
echo "File does not exist"
echo "$1"
echo ""