This file contains hidden or 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
// Oneliner JS to add project search to any public github project | |
$($('.title-actions-bar')[0]).after('Search In Project: <input type="text" onKeyUp="if (event.keyCode == 13) { window.location.href=$($(\'.title-actions-bar h1 strong a\')[0]).attr(\'href\') + \'/search?q=\' + this.value; }">'); |
This file contains hidden or 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
# Get array with all of the combinations of key=>value pairs from an input hash, taking 1 at a time when the value of a pair is an array | |
def attribute_combinations(original_hash) | |
field_varitions = [] | |
original_hash.each do |key, value| | |
if value.is_a?(Array) | |
field_varitions << {:key => key, :values => value} | |
end | |
end | |
return original_hash if field_varitions.empty? |
This file contains hidden or 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
class Comment < ActiveRecord::Base | |
#... | |
validates_uniqueness_of :body | |
# ... | |
end |
This file contains hidden or 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 'rubygems' | |
require 'raspell' | |
speller = Aspell.new('en_US') | |
input = "BLPONEA" | |
options = input.split('').permutation(5).collect { |*args| args[0].join('') } | |
puts "Given '#{input}', there are #{options.size} possible combinations of letters." |
This file contains hidden or 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
#!/usr/bin/ruby | |
require 'yaml' | |
require 'socket' | |
list_file = "~/.music" | |
vlc_socket = "/tmp/vlc.sock" | |
vlc_path = "/Applications/VLC.app/Contents/MacOS/VLC" | |
list_file = File.expand_path(list_file) |
This file contains hidden or 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
<div id="footer-bg"> | |
<div id="footer"> | |
<p align="center"><img src="/images/footer-logos.jpg" alt=""></p> | |
<ul> | |
<li class="first"><a href="/" title="Pompano Beach and Coconut Creek - General, Cosmetic, and Restorative Dentistry">Home</a></li> | |
<li><a href="/html/practice.html" title="About Our Broward County Practice - Cosmetic Dentist Manon Bourque Hutchison, D.D.S.">About the Practice</a></li> | |
<li><a href="/html/cosmetic-dentistry.html" title="Cosmetic Dentistry - Improve Your Smile with a Dental Makeover">Cosmetic Dentistry</a></li> | |
<li><a href="/html/restorative-dentistry.html" title="Restorative Dentistry - Repair and Restore Your Teeth">Restorative Dentistry</a></li> | |
<li><a href="/html/general-dentistry.html" title="General Dentistry - TMJ, Periodontal, and Preventive Care ">General Dentistry</a></li> | |
<li><a href="/html/impla |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'net/http' | |
require 'uri' | |
options = { | |
:annotate => false, | |
:exclude => [] | |
} |
This file contains hidden or 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
SET @rows = 5; | |
SET @c = (SELECT COUNT(id) FROM table); | |
SET @c = @c - @rows; | |
SET @s = CONCAT("SELECT * FROM table LIMIT ", @c, ",", @rows); | |
PREPARE stmt FROM @s; | |
EXECUTE stmt; | |
DEALLOCATE PREPARE stmt; |
This file contains hidden or 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
// adds mobile class, and mobile os to html tag | |
jQuery(document).ready(function($){ | |
var deviceAgent = navigator.userAgent.toLowerCase(); | |
if (deviceAgent.match(/(iphone|ipod|ipad)/)) { | |
$('html').addClass('ios'); | |
$('html').addClass('mobile'); | |
} | |
if (deviceAgent.match(/android/)) { |
This file contains hidden or 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
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}[" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}" | |
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch | |
git_custom_status() { | |
local cb=$(current_branch) | |
if [ -n "$cb" ]; then | |
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(parse_git_dirty)$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" |