Skip to content

Instantly share code, notes, and snippets.

View senorprogrammer's full-sized avatar
🇨🇦
Hackety hack

Chris Cummer senorprogrammer

🇨🇦
Hackety hack
View GitHub Profile

Keybase proof

I hereby claim:

  • I am senorprogrammer on github.
  • I am chriscummer (https://keybase.io/chriscummer) on keybase.
  • I have a public key whose fingerprint is 2685 5FD1 72BE FE6C 75E4 CBA9 DF5A B430 FA4E AE8F

To claim this, I am signing this object:

# ---------- Custom Git-based Prompt --------- #
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
.transparent_class {
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
h1 {
@include linear-gradient(color-stops(#999, black));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
Or, if you prefer plain CSS:
h1 {
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%,
color-stop(0%, #999999),
#
# RFC822 Email Address Regex
# --------------------------
#
# Originally written by Cal Henderson
# c.f. http://iamcal.com/publish/articles/php/parsing_email/
#
# Translated to Ruby by Tim Fletcher, with changes suggested by Dan Kubb.
#
# Licensed under a Creative Commons Attribution-ShareAlike 2.5 License
#import <mach/mach_time.h>
uint64_t start = mach_absolute_time();
// do stuff to be timed
uint64_t end = mach_absolute_time();
uint64_t elapsed = end - start;
mach_timebase_info_data_t info;
A CEO does only three things. Sets the overall vision and strategy of the company and communicates it to all stakeholders. Recruits, hires, and retains the very best talent for the company. Makes sure there is always enough cash in the bank.
@senorprogrammer
senorprogrammer / str_2_hex.rb
Created April 3, 2011 00:07
Converts strings to hex codes in Ruby
class String
def hexcode
hash = 0
self.each_byte do |chr|
hash = chr + (( hash << 5 ) - hash )
end
code = ((hash>>24)&0xFF).to_s(16) + ((hash>>16)&0xFF).to_s(16) + ((hash>>8)&0xFF).to_s(16) + (hash&0xFF).to_s(16)
return code[0..5]
end
end
@senorprogrammer
senorprogrammer / git-cmd-prompt
Created August 8, 2011 18:50
Git-based command prompt
# Git-based command prompt
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@senorprogrammer
senorprogrammer / rake_strip_whitespace
Created August 30, 2011 21:06
Rake task to strip whitespace
require 'extlib/pathname'
require 'zlib'
desc 'Strip whitespace from source files'
task :strip do
# files and extensions to process
FILES = %w[ capfile CHANGELOG LICENSE Manifest MIT-LICENSE README QUICKLINKS README_FOR_APP RUNNING_UNIT_TESTS Rakefile SPECS TODO USAGE .autotest .gitignore .htaccess ].freeze
EXTENSIONS = %w[ builder cgi conf css deploy erb example fcgi feature gemspec haml htc htm html js key markdown opts php rake ratom rb rcsv rdf rhtml rjs rpdf ru rxml sake sass sh sql thor txt vcf xml yml ].freeze
paths = Pathname.glob(Rails.root / '*') - [ Rails.root / 'vendor' ]