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
## Try 1 | |
# How could I get the following working nicely | |
Date.strptime("Ven 13 Mai. 2011, 16h00", "%a %d %b %Y, %Hh%M") | |
# I've tried to update Date::ABBR_DAYNAMES as follow | |
I18n.locale = :fr | |
Date::ABBR_DAYNAMES = I18n.t('date.abbr_day_names') | |
Date::ABBR_MONTHNAMES = I18n.t('date.abbr_month_names') |
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
config.action_controller.asset_host = Proc.new do |source, request| | |
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com" | |
ssl_host = "https://asset1.backpackit.com" | |
if request.ssl? | |
case | |
when source =~ /\.js$/ | |
ssl_host | |
when request.headers["USER_AGENT"] =~ /(Safari)/ | |
non_ssl_host |
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
CREATE TABLE `users` ( | |
`id` int(11) DEFAULT NULL, | |
`email` varchar(255) CHARACTER SET latin1 DEFAULT NULL, | |
`born_at` varchar(255) CHARACTER SET latin1 DEFAULT NULL | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
INSERT INTO `users` (`id`,`email`,`born_at`) VALUES ('1','[email protected]','1980-01-01'); | |
INSERT INTO `users` (`id`,`email`,`born_at`) VALUES ('2','[email protected]','1980-01-02'); | |
INSERT INTO `users` (`id`,`email`,`born_at`) VALUES ('3','[email protected]','1980-01-01'); | |
INSERT INTO `users` (`id`,`email`,`born_at`) VALUES ('4','[email protected]','1980-01-03'); |
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
(function() { | |
var gs = document.createElement('script'), gsc = document.createElement('div'), interval; | |
gs.type = 'text/javascript'; gs.async = true; gsc.id = 'getsatisfaction'; | |
gs.src = document.location.protocol + '//s3.amazonaws.com/getsatisfaction.com/javascripts/feedback-v2.js'; | |
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(gs); | |
(document.getElementsByTagName('body')[0]).appendChild(gsc); | |
interval = setInterval(function() { | |
if (window.GSFN !== undefined) { | |
new GSFN.feedback_widget({ |
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
config.status: creating arm-linux-eabi-fake.rb | |
executable host ruby is required. use --with-baseruby option. | |
make: *** [.rbconfig.time] Error 1 |
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="the_div"> | |
<ul id="the_list"> | |
<li id="the_item">Click me!</li> | |
</ul> | |
</div> | |
<p id="log"></p> | |
<script type="text/javascript" charset="utf-8"> | |
function log(string){ |
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
var Math2 = function() { | |
function sin(num) { | |
console.log('Compute'); | |
return Math.sin(num); | |
} | |
return { | |
sin: sin | |
} | |
}(); |
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
// Example call for functional version: | |
function logCar(object) { | |
return "I'm a " + object.color + " " + object.make | |
} | |
logCar({ color: 'blue', make: 'BMW' }); | |
// Example call for OO version: | |
var Car = function(make, color) { | |
this.make = make; |
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
var countdown = (function() { | |
var index; | |
function log(){ | |
console.log(index); | |
} | |
function iterate(){ | |
log(); | |
if(index>1) setTimeout(iterate, 1000); |
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
def url_escape(string) | |
string.gsub(/([^ ;\/?:@=#&a-zA-Z0-9_.-]+)/n) do | |
'%' + $1.unpack('H2' * $1.size).join('%').upcase | |
end.tr(' ', '+') | |
end |