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: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]
@digitalronin
digitalronin / README.md
Last active August 1, 2017 13:21
mojintranet-theme/docker/README.md

Running a local instance of MoJ Intranet

  1. Create your .env file (see dotenv.example)

  2. Prepare your data to load into the Wordpress database

  • Get a recent dump of the production intranet database from the intranet team
  • Unpack the database dump into a raw SQL file (named [something].sql) in the db-dump directory
  1. Edit your /etc/hosts file and add the following entries;