Skip to content

Instantly share code, notes, and snippets.

View joshuapinter's full-sized avatar
🎯
Focusing

Joshua Pinter joshuapinter

🎯
Focusing
View GitHub Profile
@arnold-almeida
arnold-almeida / Files changed since last tag
Created October 14, 2009 04:43
GIT: Files changed since last tag
#!/bin/bash
unset GIT_DIR
cd /path/to/project
# Get our info....
LATEST_TAG=$(git describe --tags --abbrev=0)
CURRENT_REVISION=$(git describe)
NUMBER_FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG | wc -l)
#FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG)
@samstokes
samstokes / regex-groups-global.rb
Created November 18, 2009 03:28
How to extract groups from a regex match in Ruby without globals or temporary variables. Code snippets supporting http://blog.samstokes.co.uk/post/251167556/regex-style-in-ruby
if "foo@example.com" =~ /@(.*)/
$1
else
raise "bad email"
end
# => "example.com"
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
set :application, "application"
set :deploy_to, "/var/www/application"
set :deploy_via, "remote_cache"
set :scm, :subversion
set :repository, "http://account.svn.beanstalkapp.com/repository/trunk"
set :scm_user, "deploy_dummy"
set :scm_password, File.read("#{ENV['HOME']}/.application_deployment_password").strip
@chuckbergeron
chuckbergeron / external_resource.rb
Created November 24, 2011 18:18
ExternalResource
module ExternalResource
# TODO: handle: Timeout::Error (time's up!):
# Requires a block with the HTTPClient.get call or what-have-you
# see InvitationRequestsController for details
def self.load( name = "" )
retries = 12
total = retries
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@jeremy2
jeremy2 / database.yml.erb
Created March 6, 2012 23:17
Engine Yard custom Chef Recipe for generating database.yml configuration file
#
# This file should be in .../cookbooks/database/templates/default/database.yml.erb
#
<%= @environment %>:
adapter: <%= @adapter %>
database: <%= @database %>
username: <%= @username %>
password: <%= @password %>
host: <%= @host %>
@9re
9re / ExifUtil.java
Created March 7, 2012 00:16
fix flipped / rotated image by getting exif orientation
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.os.Build;
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@rduplain
rduplain / MainActivity.java
Created May 8, 2012 20:08
A very simple full-screen WebView activity for Android native wrappers, as a starting point.
package com.willowtreeapps.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {