This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:window.location = document.location.protocol + '//' + document.location.host + '/admin_menu/flush-cache?destination=' + document.location.pathname.substring(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
function Async(options){}; | |
Async.each=function(list,callback){ | |
var _count=0; | |
if(list.length==null){ | |
_list=[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
def gravatar(user, options = {}) | |
email_address = user.email.downcase | |
hash = Digest::MD5.hexdigest(email_address) | |
image_src = "http://www.gravatar.com/avatar/#{hash}" | |
unless options.empty? | |
query_string = options.map {|key, value| "#{key}=#{value}"} | |
image_src << "?" << query_string.join("&") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can't exec "ruby": No such file or directory at /usr/sbin/munin-node line 564, <STDIN> line 47. | |
2011/01/19-14:00:37 Plugin timeout: passenger_memory_stats : Interrupted system call | |
(pid 11057) | |
Can't exec "ruby": No such file or directory at /usr/sbin/munin-node line 564, <STDIN> line 58. | |
2011/01/19-14:00:50 Plugin timeout: passenger_status : Interrupted system call | |
(pid 11159) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash prompt | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
PS1="$RED\$(date +%H:%M) \w$YELLOW\$(parse_git_branch)$GREEN\$ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Required for meta_search to use a named scope | |
search_methods :for_location, :at_location, :name_contains | |
scope :for_location, lambda { |location| location = Location.find(location) unless location.is_a?(Location); joins('LEFT OUTER JOIN administrators_locations ON administrators.id = administrator_id').where('location_id IN(?)', location.path_ids) } | |
scope :at_location, lambda { |location| location = Location.find(location) unless location.is_a?(Location); joins('INNER JOIN administrators_locations ON administrators.id = administrator_id').where('location_id = ?', location.id) } | |
scope :name_contains, lambda { |name| where("CONCAT_WS(' ', forename, surname) LIKE ?", "%#{name}%") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
* { margin: 0; padding: 0; } | |
body { font: 14px Georgia, serif; } | |
table { border-collapse: collapse; width: 600px; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A JavaScript focussed git pre-commit hook | |
# | |
# It ensures that any files containing console.log() or alert() calls aren't able to be committed. | |
# It also ensures that all JavaScript passes JSHint(which is assumed to be installed). A static code analysis tool which detects errors and potential issues from smelly JS - see http://www.jshint.com/ for more details | |
# | |
# Written by Damian Nicholson - @damian | |
if git rev-parse --verify HEAD >/dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
a { | |
display:inline-block; | |
-webkit-box-sizing:border-box; | |
-moz-box-sizing:border-box; | |
box-sizing:border-box; | |
width:100px; | |
height:100px; | |
-webkit-border-radius:50px; | |
-moz-border-radius:50px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
desc 'Backup database' | |
task :backup => :environment do | |
# Loads in database config and finds the correct environment | |
config = YAML::load(File.open('config/database.yml'))[Rails.env] | |
# Creates a filename which is unique to the backup | |
filename = "backup_#{Time.now.to_i}" | |
# Run a mysqldump using our credentials from database config |