Skip to content

Instantly share code, notes, and snippets.

jQuery(function(){
// Cascading series of finds to focus the most likely relevant field
window.setTimeout(function() {
jQuery("div.fieldWithErrors :input:visible:enabled:first, :input:visible:enabled:first").focus();
jQuery(".tabs-container").not(".tabs-hide").find("div.fieldWithErrors :input:visible:enabled:first, :input:visible:enabled:first").focus();
}, 100);
});
my_time_formats = {
:date_time12 => "%m/%d/%y %I:%M%p",
:date_time24 => "%m/%d/%y %H:%M",
:file => "%Y-%m-%d-%H-%M%p",
:search => "%m/%d/%Y",
:default => "%m/%d/%y %I:%M%p"
}
my_date_formats = {
:date_time12 => "%m/%d/%y",
:date_time24 => "%m/%d/%y",
# {{ansible_managed}}
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
{% for item in groups['all'] %}
{% set ip = next(ip for ip in hostvars[item]['ansible_all_ipv4_addresses'] if ip.find("10.") == 0, hostvars[item]['ansible_default_ipv4']) %}
{% if ip %}
{{ ip }} {{ item }}
{% endif %}
{% endfor %}
param1={% for z in groups['zookeeper'] %}{% if loop.index > 1 %}:{% endif %}{{ hostvars[z]['ansible_fqdn'] }}:{{ port }}{% endfor %}
param2=something
param3=something
#!/usr/bin/env bash
### BEGIN INIT INFO
# Provides: druid_historical
# Required-Start: $local_fs $remote_fs $syslog $network
# Required-Stop: $local_fs $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts Druid historical service
# Description: start Druid historical service using start-stop-daemon
### END INIT INFO
@agile
agile / bleh.rb
Last active August 29, 2015 13:56
class Parent < ActiveRecord::Base
# assume there's a varchar field on the table called "name"
def name
puts "Holla from tha Parent!"
super
read_attribute(:name) || "default value!"
end
end
class Child < Parent
describe SomeController do
before(:each) do
login as 'user'
end
...
end
@agile
agile / rename_screenshots.sh
Created September 8, 2014 14:01
Stupid script to rename stupid screenshots for a stupid issue tracker
#!/bin/bash
#
# Rename screenshots into a format Jira won't complain about.. ;P
#
SCREENSHOTDIR=~/
LOCKFILE=$(dirname $0)/$(basename $0).pid
echo "LOCKFILE: ${LOCKFILE}"
if [ -e ${LOCKFILE} ]; then
@agile
agile / jvm
Created September 18, 2014 13:33
Script to switch between different Java VMs on a Debian based system
#!/usr/bin/env bash
#
# Switch between different installed Java VMs in a Debian based system
#
available=( $(update-alternatives --list java) )
if [ -n "${1}" ]; then
case "${1}" in
/*bin/java)
VM="${1}"
function! s:gotoline()
let file = bufname("%")
let names = matchlist( file, '\(.*\):\(\d\+\)')
if len(names) != 0 && filereadable(names[1])
exec ":e " . names[1]
exec ":" . names[2]
if foldlevel(names[2]) > 0
exec ":foldopen!"
endif