Skip to content

Instantly share code, notes, and snippets.

View jnwheeler44's full-sized avatar

Justin Wheeler jnwheeler44

View GitHub Profile
@jnwheeler44
jnwheeler44 / PIE-new.htc
Created September 17, 2011 15:29
Handy CSS3PIE mixins
<!--PIE:CSS3 rendering for IE Version 1.0beta3 http:Dual-licensed for use under the Apache License Version 2.0 or the General Public License(GPL)Version 2.--><PUBLIC:COMPONENT lightWeight="true"><PUBLIC:ATTACH EVENT="oncontentready"FOR="element"ONEVENT="init()"/><PUBLIC:ATTACH EVENT="ondocumentready"FOR="element"ONEVENT="init()"/><PUBLIC:ATTACH EVENT="ondetach"FOR="element"ONEVENT="cleanup()"/><script type="text/javascript">var doc=element.document;var PIE=window['PIE'];if(!PIE){PIE=window['PIE']={CSS_PREFIX:'-pie-',STYLE_PREFIX:'Pie',CLASS_PREFIX:'pie_',tableCellTags:{'TD':1,'TH':1}};try{doc.execCommand('BackgroundImageCache',false,true)}catch(e){}PIE.ieVersion=function(){var v=4,div=doc.createElement('div'),all=div.getElementsByTagName('i');while(div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->',all[0]){}return v}();if(PIE.ieVersion===6){PIE.CSS_PREFIX=PIE.CSS_PREFIX.replace(/^-/,'')}PIE.ie8DocMode=PIE.ieVersion===8&&doc.documentMode;PIE.Util={createVmlElement:function(tag){var vmlPrefix='css3vml
@jnwheeler44
jnwheeler44 / gist:1334019
Created November 2, 2011 16:01
Convert text to a dom element in jQuery
// Had an interesting problem today by trying to load a textarea's contents as dom elements.
// Here's what I did:
// get my value and convert into a dom element
var string = $('#article_body').val();
var element = $("<div>" + string + "</div>");
// from there, I can get what I need
element.find("video").attr('src');
@jnwheeler44
jnwheeler44 / database.yml
Created February 16, 2012 09:06
Example configuration for database.yml in version control. Allows override of default values.
default_dev: &default_dev
adapter: postgresql
host: localhost
database: db
pool: 500
username: user
password: pass
timeout: 25000
<%= file = File.join(Rails.root.to_s, "../config", "dev.yml")
IO.read(file) if File.exist?(file) %>
@jnwheeler44
jnwheeler44 / bundler_mysql.shell
Created September 11, 2012 19:13
Mysql Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. using Bundler
> bundle install
...
Installing mysql (x.x.x) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
> bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
Factory.sequence :email do |n|
"test#{n}@example.com"
end
Factory.sequence :username do |n|
"user#{n}"
end
Factory.sequence :visitor_token do |n|
"token#{n}"
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNZOOO88DDDDDDDNNNNNDD88OOOOOO8DNNMMMMMMMNNNNDZZNNNNNNNNDDD8D77ZND8MMMMN87I77$OO
MMMMNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMZ8888DDDDDNNNNNNNNNDDOO8D88888Z77ZZDNNMMMNMMM88D8OZ8DDDNNNNNZ88D8MMMMMO$I77$ZDNM
MMMMNNNMMMMMMMMN8DMNNDDNNMMMMMMMMMMMMMNO8D8DDDDNDNNNNNN
Sequel.migration do
change do
create_table :polls do
primary_key :id
string :title
string :author
boolean :active
end
end
end
if pid = params[:pid]
if `ps -o state -p #{pid.to_i} | tail +2` =~ /S+/
sleep(5)
redirect_to :action => :get_report, :pid => pid, :name => params[:name]
return
end
end
,:$?ZZZ~$,,,=$:OZZ=Z,.,,=Z:ZZ,,,,$O~ZZ,OO,,.,,ZZZZ~,,,,,Z=O$Z+O$,,,,,,,,,,,,,,,.
,,Z:$,ZOZ,,,,Z,$~$~Z,,,.,$,O,,,,,+?7=Z:Z?,,.,+O+Z?7,,,,,,Z:Z$O7,,,,,,,,,,,,,,,,.
,,$.:~Z,..,.,Z,,,:Z:,,,,,Z~$..,,,Z,Z,Z,Z,,,,,Z=Z$,Z,,,,.,OZ+O:,,,,,,,,,,,,,,,,,.
,~Z?ZZI,,..,I+Z$Z:O,...,??7~,,,,,Z,Z~$=Z,,,,Z:$ZO~$,,,,,,+Z7Z,,,,,,,,,,,,,,,,,,.
~Z~Z$,,,.,,?$:$$$~Z$,,,+$:$Z,,.,ZZ+$ZZ$Z,..ZZZ$,Z?ZZ,,,,,Z7$$,,,,,,,,,,,,,,,,,,.
$$$$Z,,,,,,$Z$$7$Z$Z.,.Z$Z$7,,..$Z$ZZ$:,,.,Z$ZOIZ$$Z..,,?ZZ$O,,,,,,,,,,,,,,,,,,.
...............+?7++ON??+??I?????+8...,..,..............,...,...................
...........,,.~$+?$$8D$++?????????++............................................
.............~+NIZZIO,8?7???++I????+D..............,.......,....................
[7] pry(main)> range = ((Date.today - 1000.years)..(Date.today + 1000.years))
=> Sun, 26 Oct 1012..Mon, 26 Oct 3012
[11] pry(main)> target = (Date.today + 999.years)
=> Sat, 26 Oct 3011
[12] pry(main)> Benchmark.measure { range.include? target }
=> 0.410000 0.000000 0.410000 ( 0.411619)
[13] pry(main)> Benchmark.measure { range === target }