This file contains 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
$('id_of_form').observe('submit', function(e){ | |
var form = e.element(); | |
// stops it from submitting | |
Event.stop(e); | |
// use the form action, or a hardcoded URL | |
var url = form.action; | |
new Ajax.Request(url, { | |
parameters: form.serialize(), |
This file contains 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
~/Sites/fortaleza[master]$ git checkout vcgames-list-all-games-page | |
error: Untracked working tree file 'public/flash/games/vcgames/PinBall/PinBallLogo.swf' would be overwritten by merge. | |
~/Sites/fortaleza[master]$ rm public/flash/games/vcgames/PinBall/PinBallLogo.swf | |
~/Sites/fortaleza[master*]$ git checkout vcgames-list-all-games-page | |
Switched to branch 'vcgames-list-all-games-page' | |
~/Sites/fortaleza[vcgames-list-all-games-page]$ git rebase master | |
First, rewinding head to replay your work on top of it... | |
error: Untracked working tree file 'public/flash/games/vcgames/PinBall/PinballLogo.swf' would be overwritten by merge. | |
could not detach HEAD | |
~/Sites/fortaleza[vcgames-list-all-games-page]$ mv public/flash/games/vcgames/PinBall/PinBallLogo.swf public/flash/games/vcgames/PinBall/PinballLogo.swf |
This file contains 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
namespace :mb do | |
namespace :sass do | |
desc "clear out all Sass generated stylesheets" | |
task :wipe => :merb_env do | |
template_location = Sass::Plugin.options[:template_location] | |
Dir.glob(File.join(template_location, "**", "*.sass")).entries.each do |file| | |
name = file.sub(template_location + "/", "")[0...-5] | |
css = Sass::Plugin.send(:css_filename, name) |
This file contains 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
# Setting play_mode equals params mode if it exists and is equals fun or real | |
play_mode = params[:mode] if params[:mode] and ['fun', 'real'].include? params[:mode] | |
# Setting play mode equals fun if user is not logged in | |
play_mode = 'fun' unless has_user_logged? | |
# Setting game_mode equals demoplay when play_mode equals fun | |
game_mode = play_mode == 'fun' ? 'demoplay' : '' |
This file contains 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 | |
while (input = STDIN.read) != '' | |
rev_old, rev_new, ref = input.split(" ") | |
url = nil | |
if ref == "refs/heads/master" | |
url = "http://172.23.0.150:8080/job/Project%20Master/build" | |
elsif ref == "refs/heads/other-branch" | |
url = "http://172.23.0.150:8080/job/Project%20Other/build" |
This file contains 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
irb(main):001:0> name = "réunion-journalière" | |
=> "r\303\251union-journali\303\250re" | |
irb(main):002:0> File.open(name, 'w'){|f| f.write 'x' } | |
=> 1 | |
irb(main):003:0> exit | |
$ ls -al | |
> total 36 | |
> drwxr-xr-x 2 rlivsey rlivsey 4096 Jul 3 22:00 . | |
> drwxrwxr-x 10 rlivsey rlivsey 4096 Jul 3 12:20 .. |
This file contains 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
# broked | |
def render_pdf(html, name) | |
in_file = "#{name}.xhtml" | |
out_file = "#{name}.pdf" | |
# if the file name contains accents, they are changed to '??' | |
File.open(in_file, 'w') do |f| | |
f.write html | |
end |
This file contains 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
# returns duplicates, essentially the same as the datamapper query | |
SELECT books.* | |
FROM books | |
INNER JOIN readers ON readers.book_id = books.id | |
WHERE readers.user_id = xxx OR books.private = FALSE | |
# gets rid of the duplicates because of the DISTINCT | |
SELECT DISTINCT books.* | |
FROM books | |
INNER JOIN readers ON readers.book_id = books.id |
This file contains 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
document.observe('dom:loaded', function(){ | |
$$('select.changer').each(function(select){ | |
select.observe('change', function(){ | |
new Ajax.Updater('other_div', '/some/action', { | |
parameters: {selected: $F(select)} | |
}); | |
}); | |
}); | |
}); |
This file contains 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
document.observe('dom:loaded', function(){ | |
$$('select.changer').each(function(select){ | |
select.observe('change', function(){ | |
new Ajax.Updater('other_div', '/some/action', { | |
parameters: {selected: $F(select)} | |
}); | |
}); | |
}); | |
}); |
OlderNewer