Skip to content

Instantly share code, notes, and snippets.

@digitalronin
digitalronin / gitrmall.rb
Created July 22, 2008 13:36
Ruby script to automatically "git rm" deleted files
#!/usr/bin/env ruby
# Ruby script to automatically "git rm" deleted files
DELETED_REXP = /^#\s+deleted:\s+(.*)/
MARKER_LINE = '# Changed but not updated:'
lines = `git status`
found_marker = false
"
" Find a file. (like cmd-t in textmate)
"
" Put this into ~/.vim/plugins/Find.vim
"
" Modified not to find svn files, and not to look in ./vendor
"
" Based on http://www.vim.org/tips/tip.php?tip_id=1432 by Samuel Hughes
"
" From his notes;
#!/bin/bash
# Script to take a local git project and set up a remote project on our
# git server
# NB: This assumes your current working dir is the top-level of the project
# you want to send to the remote server, and that the local project is
# already a git repo.
GIT_SERVER=yourgitserver
GIT_HOME=/home/remoteuser/git
#!/usr/bin/env ruby
require 'rubygems'
require 'active_resource'
require 'pp'
class Slice < ActiveResource::Base
API_KEY = 'MY API KEY GOES HERE'
self.site = %[https://#{API_KEY}@api.slicehost.com]
self.timeout = 600
<h1>This is a test</h1>
@digitalronin
digitalronin / gist:1455061
Created December 10, 2011 12:34
nav menu
<nav>
<ul id='nav'>
<li class='i_users'><a href="/admin/users"><span>Users</span></a></li>
<li class='i_table'>
<a class="active"><span>Customers</span></a>
<ul>
<li><a href="/advertisers" class="active"><span>Advertisers</span></a></li>
<li><a href="/publishers"><span>Publishers</span></a></li>
</ul>
</li>
@digitalronin
digitalronin / gist:9a0258d6b182f647e5d7
Created August 1, 2015 11:25
Bash script to reload the current Chrome (or Safari) browser window
#!/bin/bash
/usr/bin/osascript <<EOF
tell application "Google Chrome"
set docUrl to URL of (active tab of window 1)
set URL of (active tab of window 1) to docUrl
end tell
EOF
# /usr/bin/osascript <<EOF
@digitalronin
digitalronin / gist:dc81b24f2fa4264b524f
Last active March 8, 2016 16:35
ExUnit.DocTest: Doesn't run test when "iex>" prefix contains numbers
# using Elixir 1.2.2
$ mix new my_app
$ cd my_app
$ vi lib/my_app.ex
defmodule MyApp do
@doc """
iex(1)> MyApp.foo
123
class ImagesController < ApplicationController
skip_before_filter :ensure_logged_in
def show
id = "%s.%s" % [params[:id], params[:format]]
image = AdImage.find(id).decorate
send_data image.contents, :type => image.mimetype, :disposition => "inline"
rescue
render :text => ''
end
@digitalronin
digitalronin / git-ticket
Last active February 17, 2017 15:55
Enable "git ticket 12345" to create a git branch from the title of Pivotal ticket 12345
#!/usr/bin/env ruby
require 'json'
# Create a git branch, off master, for a specific Pivotal Tracker ticket.
# The name of the branch will be the normalised title of the pivotal ticket.
USAGE = "USAGE:\ngit ticket TICKET_ID\n"
ticketid = ARGV[0]