Skip to content

Instantly share code, notes, and snippets.

View elskwid's full-sized avatar
🤡

Don Morrison elskwid

🤡
View GitHub Profile
# encoding: utf-8
class DocumentUploader < CarrierWave::Uploader::Base
include ::CarrierWave::Backgrounder::Delay
include CarrierWave::MimeTypes
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
# include CarrierWave::MiniMagick
include CarrierWave::UNOConv
@elskwid
elskwid / probe.rb
Created September 6, 2012 05:57 — forked from supernullset/probe.rb
Weird net/ftp behavior
STDOUT.sync = true
require "net/ftp"
root = "tgftp.nws.noaa.gov"
total = 0
run = true
puts ">> Probing max connections for: #{root}"
@elskwid
elskwid / ex.scala
Created October 6, 2015 23:16 — forked from penryu/ex.scala
object Example {
def main(args: Array[String]): Unit = {
println("Scala!")
// create some values to use
// TERM: assignment
val a = 1
val b = 2
val c = 3
importPackage(java.io);
importPackage(java.lang);
System.out.println("JavaScript!");
// create some variables to use
// TERM: assignment
var a = 1;
var b = 2;
var c = 3;
@elskwid
elskwid / gist:2422707
Created April 19, 2012 18:09 — forked from phlipper/gist:2422700
Software Colloquialisms

@elskwid is at least equally responsible for this ...

Software Colloquialisms

Sex

  • maintenance release - masturbation
  • continuous integration - daily sex
  • release management - weekly sex on the same day each week
  • fail fast - premature ejaculation
@elskwid
elskwid / ps_template_parser.rb
Created January 31, 2012 22:41 — forked from Alfaj0r/ps_template_parser.rb
Powerscribe templates XML parsing
#!/usr/bin/env ruby
require 'rexml/document'
include REXML
#open the XML file exported from Powerscribe
# Ruby lets us open the file in a block (thereby closing it when it's done)
File.open("Voice.xml") do |file|
# The "block" is that do ... end syntax and |file| is a reference to the file we've opened
doc = Document.new(file)
# Version 0 (original)
def to
begin
name=self.first_name
unless name.nil?
name
name=name+" "+self.last_name
else
name=self.last_name
end
@elskwid
elskwid / gist:658965
Created November 1, 2010 22:10 — forked from brianjlandau/gist:176754
Useful gist for cap deploy gh style
# you'd obviously have more settings somewhere
set :scm, :git
set :repository, "git@github.com:defunkt/github.git"
set :branch, "origin/master"
set :migrate_target, :current
set :use_sudo, false
set :ssh_options, {:forward_agent => true}
set :rails_env, 'production'
set(:latest_release) { fetch(:current_path) }
#!/usr/bin/env ruby
#
# Update JIRA with git commit messages
#
# == Usage ==
#
# To update a JIRA issue, prepend the first line of your git commit message
# with the issue key and a colon:
#
# $ git commit -m "GIT-1: Updates something"
task :do_a_thing => :environment do
@zh_cn = " 联想"
@zh_tw = " 聯想"
%w( zh-cn zh-tw ).each do |chinese|
lang = Language.find_by_language_code(chinese)
LocalizedString.all(:conditions => ["language_id = ? and string_value like '%FindMe%'", lang.id]).each do |loc|
loc.string_value.gsub!('FindMe', instance_variable_get("@#{chinese.underscore}"))
loc.save_without_validation