Skip to content

Instantly share code, notes, and snippets.

View stevobengtson's full-sized avatar

Steven Bengtson stevobengtson

  • Bengtson
  • Victoria, BC, Canada
View GitHub Profile
@stevobengtson
stevobengtson / .tmux.conf
Created May 9, 2024 06:16
Tmux configuration
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
unbind %
bind | split-window -h
@stevobengtson
stevobengtson / ltw
Last active February 7, 2023 22:31
Sail script to use in Symfony projects
#!/usr/bin/env bash
UNAMEOUT="$(uname -s)"
# Verify operating system is supported...
case "${UNAMEOUT}" in
Linux*) MACHINE=linux;;
Darwin*) MACHINE=mac;;
*) MACHINE="UNKNOWN"
esac
@stevobengtson
stevobengtson / .pryrc
Last active June 22, 2017 19:21
My PryRC File for RubyOnRails
# place this file in ~/.pryrc
# vim FTW - you can use 'mate' or whichever your prefer
Pry.config.editor = 'vim'
Pry.config.hooks.add_hook :after_session, :say_bye do
puts "bye-bye" if Pry.active_sessions == 1
end
# Prompt with ruby version
#!/bin/bash
APP_NAME=$1
PORT=$2
: ${PORT:=4000}
echo "Creating a Phoenix app called $APP_NAME in docker with the port $PORT."
docker run -it --rm -v "$PWD":/code -w /phoenix stevobengtson/vt-phoenix-docker mix phoenix.new /code/$APP_NAME
cd $1
@stevobengtson
stevobengtson / jQuery_short
Created April 14, 2015 00:18
jQuery ajax shorthands
jQuery.each( [ "put", "patch", "delete" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// Shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
// The url can be an options object (which then must have .url)
@stevobengtson
stevobengtson / gist:c876d7f4593845b08b2e
Last active August 29, 2015 14:08
Nested Namespace Example
<html>
<head>
<script type="application/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
</head>
<body>
<script type="application/javascript">
(function( VT, $, undefined ) {
VT.whoami = "VT";
@stevobengtson
stevobengtson / gist:16a89a194055f7cce11d
Last active August 29, 2015 14:08
Javascript Name Spaced Object
// Example of creating a Name Spaced object in javascript inspired by:
// http://stackoverflow.com/questions/881515/how-do-i-declare-a-namespace-in-javascript
// Jaco Pretorius: http://stackoverflow.com/users/121531/jaco-pretorius
(function( skillet, $, undefined ) {
//Private Property
var isHot = true;
//Public Property
skillet.ingredient = "Bacon Strips";
@stevobengtson
stevobengtson / js_objects.js
Last active August 29, 2015 14:07
Javascript Objects
/**
* Public Javascript Object
*/
function Shape(sides, fillColor, strokeColor) {
// Public properties
this.sides = sides;
this.fillColor = fillColor;
this.strokeColor = strokeColor;
// Private properties
@stevobengtson
stevobengtson / brew_cleanup.sh
Created May 15, 2014 22:16
Brew clean up script
#!/bin/bash
#
# Clear out old, inactive versions of software
# installed by Homebrew.
# Created by Colin and listed on http://www.nonsenseby.me/blog/2014/01/12/remove-old-versions-in-homebrew/
#
set -o noglob
# Some brew settings.
readonly BREW_CMD=$( which brew )
readonly BREW_AWK="/tmp/brew.$$.awk"