Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# recompile all rbenv versions of ruby to avoid CVE-2013-6393 pwnage
# https://groups.google.com/forum/#!topic/rubysec-announce/3sx25iR7yHQ
#
# curl https://gist.github.com/samg/9098647/raw | bash
set -x
cd ~/.rbenv/plugins/ruby-build/
git pull
/*
* Scale all textareas dynamically on the page
* Requires Prototype
*/
function scaleTextareas(){
$$('textarea').each(function(t){
t.style.height = Math.floor($F(t).split('\n').inject(1, function(m, s){
return m += (s.length/(t.offsetWidth/10)) + 1;
})) + 8 + 'em';
});
require 'open3'
describe 'my_script' do
def run *args
options = args.extract_options!
args.unshift './my_script'
out = err = ''
Open3.popen3(args.join(' ')) do |i, o, e|
i.write options[:stdin]
# == a smarter way to pluralize
#
# Accepts an integer as an optional argument
# >> "actress".smart_pluralize
# => "actresses"
# >> "guitar".smart_pluralize(1)
# => "guitar"
# >> "monkey".smart_pluralize(2)
# => "monkeys"
#
* keep people working on internal projects, assign and schedule the work
* dont look desperate, dont have immediate availability
* can tell a client you can 'shuffle internal projects' to accomodate them
* online ads dont work well
* referrals instead
* do a great job every single time
* voice calls important
* when people call you call them back
/*
* Scale all textareas dynamically on the page
* Requires JQuery
*/
function scaleTextareas() {
$('textarea').each(function(i, t){
var m = 0;
$($(t).val().split("\n")).each(function(i, s){
m += (s.length/(t.offsetWidth/10)) + 1;
});
udo apt-get install screen vim git-core mysql-server libmysqlclient15-dev build-essential libssl-dev libreadline5-dev zlib1g-dev ruby-full rubygems libtiff4 ghostscript liblcms1 libexif12 libxml2 zlib1g bzip2 imagemagick libmagick9-dev postfix apache2 libapache2-mod-passenger sqlite3 libsqlite3-dev
$().ready(function(){
// Instant Search
$('#q').keyup(function(){
$('.search_item').each(function(){
var re = new RegExp($('#q').val(), 'i')
if($(this).children('.search_text')[0].innerHTML.match(re)){
$(this).show();
}else{
$(this).hide();
};
// Search hint
$($('#q')[0]).addClass('search-hint');
$($('#q')[0]).val('Search');
$('#q').focus(function(){
if ($(this).val() == 'Search'){
$(this).removeClass('search-hint');
$(this).val('');
}
});
$('#q').blur(function(){
# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]