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
#!/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
<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/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
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
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
# 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
// 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
{"contributors":null,"text":"just testing, dont mind me","geo":null,"place":null,"in_reply_to_screen_name":null,"favorited":false,"source":"web","in_reply_to_user_id":null,"coordinates":null,"created_at":"Wed Jul 28 06:44:15 +0000 2010","user":{"lang":"en","profile_use_background_image":true,"profile_sidebar_fill_color":"efefef","following":null,"geo_enabled":false,"followers_count":106,"location":"San Diego, CA","verified":false,"profile_sidebar_border_color":"eeeeee","follow_request_sent":null,"notifications":null,"friends_count":88,"description":"Bleeding edge Web Applications Developer","favourites_count":0,"profile_background_color":"131516","url":"http://chrischerry.name","profile_image_url":"http://a1.twimg.com/profile_images/94668409/redfeedicon_528_normal.png","listed_count":7,"profile_background_image_url":"http://s.twimg.com/a/1279056489/images/themes/theme14/bg.gif","time_zone":"Pacific Time (US & Canada)","profile_text_color":"333333","protected":false,"statuses_count":2224,"created_at":"Thu Mar |
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
/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i |