Skip to content

Instantly share code, notes, and snippets.

@wesleybliss
wesleybliss / convert_files_utf8_to_ansi.php
Created October 10, 2014 20:18
Example of converting files in a directory from UTF-8 to ASCII
<?php
print PHP_EOL;
if ( count($argv) < 2 ) {
exit(
'Convert all files in a directory from UTF-8 to ANSI' .
PHP_EOL . 'USAGE: ' . $argv[0] . ' <path>' . PHP_EOL
);
}
@wesleybliss
wesleybliss / gist:1ec4c220bd94664ecdd6
Created December 12, 2014 23:21
POSTMan Get Fields + Values
javascript:var keys=$('input[type="text"].keyvalueeditor-key'),vals=$('input[type="text"].keyvalueeditor-value');done="";for(var i=0;i<keys.length;i++){var key,val;try{key=$(keys[i]).val()}catch(e){key="[UNKNOWN]"}try{val=$(vals[i]).val()}catch(e){val="[UNKNOWN]"}done+=key+"\n"+val+"\n\n"}console.log(done);
@wesleybliss
wesleybliss / recurse_xml.php
Created January 13, 2015 21:05
Recursing all nodes in an XML document (example)
<?php
/**********************************
* CONFIG
*********************************/
// Config (change these if you want)
define( 'DISABLE_TIME_LIMIT', true );
define( 'DISABLE_OUTPUT_BUFFERING', true );
define( 'CUSTOM_ERROR_HANDLING', false );
1) 1st Group class is free. 1st month trail is $80 for 8 classes.
2) 1st private lesson is $40.00, for 1 person for 2 its $60. You can buy up to 8 personal training sessions
at special reduce rate of $40 each. ($320 total) Expires in 6 weeks.
GROUP CLASSES:
Classes are on average $15 per session.
@wesleybliss
wesleybliss / js_classical_inheritance_02__person_nihonjin
Created February 5, 2015 05:37
JavaScript Classical Inheritance #2
var Person = function() {
this.helloMessage = 'Hello';
};
Person.prototype.sayHello = function() {
console.log( this.helloMessage );
};
var Nihonjin = function() {
@wesleybliss
wesleybliss / git_force_init_submodules.lua
Created February 11, 2015 19:34
Force update all GIT submodules when update/recursive/foreach doesn't fully work.
#! /usr/bin/env lua
print("")
local showUsage = function()
print([[
Force update all submodules when update/recursive/foreach doesn't work.
USAGE
]] .. arg[0] .. [[ (within the parent repository's home directory)
@wesleybliss
wesleybliss / basic_ufw_config.sh
Created February 19, 2015 16:25
Basic UFW Configuration Setup
#!/bin/bash
echo
echo "Basic UFW Configuration Setup"
echo "============================="
echo
echo
read -r -p "#1. Do you need IPv6 support?" response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
@wesleybliss
wesleybliss / git_merge_all
Created March 24, 2015 15:27
Git merge all branches matching a pattern.
#!/bin/bash
echo
if [ -z "$1" ]; then
echo "Merge all branches matching a pattern (e.g. sprint number) into the current branch."
echo
echo "USAGE"
echo "$0 <pattern>"
exit 1
@wesleybliss
wesleybliss / git_branch_enhanced
Created March 25, 2015 18:11
Shows Git branches only for the current sprint, if detected, and allows for a grep parameter for filtering results.
#!/bin/bash
#
# A more intelligent branch listing.
#
# [ Sprint Detection ]
# If a current sprint is detected, only corresponding branches
# will be listed. The pattern is "sprint/X/" where X could be any string.
#
# [ Automatic Pattern Matching ]
@wesleybliss
wesleybliss / lowercase_file_names
Created April 9, 2015 15:12
Lowercase the names of all files in a directory (defaults to current directory).
#!/bin/bash
echo
path="."
counter=0
remainder=0
if [ ! -z "$1" ]; then
path="$1"
fi