Skip to content

Instantly share code, notes, and snippets.

#Put this inside ~/.bash_profile
#Function for lazy git commiting.
#Instead of: git commit -m "some message"
#Type: gci some message
gci() {
if [ -z "$1" ] # Is parameter #1 zero length?
then
echo "You must pass a commit message like this: gci some message here - which then becomes: git commit -m 'some message here'"
else
git commit -m "$*"
#! /usr/bin/env ruby
require 'curses'
include Curses
include Curses::Key
class Fixnum
def clamp(low, high)
v = self
v = low if self < low
@gabehollombe
gabehollombe / a3update.py
Created April 9, 2022 09:11 — forked from marceldev89/a3update.py
Arma 3 Linux server and mod updater (workshop)
#!/usr/bin/python3
# MIT License
#
# Copyright (c) 2017 Marcel de Vries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@gabehollombe
gabehollombe / gist:7854417
Last active February 2, 2020 12:34
Clojure from the Ground Up - Sequences - Exercises My answers to the exercises from: http://aphyr.com/posts/304-clojure-from-the-ground-up-sequences
; Sequences
;--------------------------------------------------
; Write a function to find out if a string is a palindrome–that is, if it looks the same forwards and backwards.
(defn revStr
"Reverses s and returns as a string"
[s]
(apply str (reverse s)))
(defn palindrome?
@gabehollombe
gabehollombe / Main.elm
Created July 26, 2016 08:04
Example solution for Exercises from the Elm guide chapter on Forms
module Main exposing (..)
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, onClick)
import List exposing (..)
import String exposing (..)
import Char exposing (..)
Here's a repro:
1. Visit https://nycdemo152.auth.us-east-1.amazoncognito.com/login?response_type=token&client_id=1o72223p0ont9u6ctbdus5svsu&redirect_uri=https://aws.amazon.com/cognito/
2. Click on 'Continue with Facebook'
@gabehollombe
gabehollombe / Capybara CSS Visibility Testing
Created May 14, 2010 05:13
Testing text visibility on page with capybara
#relevant lines in features/support/env.rb
Capybara.default_selector = :css
Capybara.javascript_driver = :culerity
Capybara.ignore_hidden_elements = true
#features/hidden_text_testing.feature
@javascript
Scenario: Testing test hidden via inline style with 'should not see'
When I visit the the public index.html page
Then I should not see "Hidden Via Comment"
@gabehollombe
gabehollombe / similar_lines.rb
Created December 6, 2013 01:26
A simple Ruby script to calculate the percentage of similar lines between files. Useful for seeing duplicated lines in rails view files, for example.
# Show the percentage of similar lines between files.
# Requires: diffy gem
# Usage: Edit line 33 to match the files you're interested in, then run this script.
require 'rubygems'
require 'diffy'
def get_dup_lines_percentage(file1, file2)
starts_with_minus = /^-.*/
@gabehollombe
gabehollombe / .vimrc
Created November 19, 2013 12:56
Simple function to zoom Vimux's runner pane to fullscreen from Vim.
" If you use Vim, and tmux, you should be using Vimux: https://github.com/benmills/vimux
" This snippet will let you easily zoom Vimux's runner pane to fullscreen.
" It's really helpful for seeing more of a stack trace.
" Requires tmux >= 1.8
" Function to tell Vimux to have make tmux zoom its runner pane.
function! VimuxZoomRunner()
call VimuxInspectRunner()
call system("tmux resize-pane -Z")
endfunction
@gabehollombe
gabehollombe / gist:7365170
Created November 8, 2013 02:10
SSH Tricks
TUNNELING
Expose server port 456 on local port 123
$ ssh -L 123:localhost:456 user@yourserver.com
Transparent SOCKS proxy on localhost:12345
$ ssh -D 12345 user@yourserver.com