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
/* workaround for 2 bugs related to jQuery Tools Dateinput: | |
* 1) the initial value is wrongly set | |
* 2) "data-" attributes presents on the target input get wiped out | |
*/ | |
$(":date[data-backend]").each(function() { | |
var backend_attr = $(this).attr("data-backend"); | |
var value = $(backend_attr).val(); | |
var year = parseInt(value.substring(0, 4), 10); | |
var month = parseInt(value.substring(4, 6), 10) - 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
## UPDATE 2010-12-14: facets-2.9.0 and hashery-1.3.0 doesn't work with rails 3.0.3 (due to a bug of facets): | |
## https://github.com/rubyworks/hashery/issues#issue/6 | |
## https://github.com/rubyworks/facets/issues/issue/31 | |
## in your Gemfile | |
gem "facets" | |
gem "hashery" | |
## then execute in the shell |
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 | |
dictionary = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a | |
password = 1.upto(10).map {|i| | |
index = (rand * dictionary.size).to_i | |
dictionary[index] | |
}.join | |
puts "random password: #{password}" |
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
>> (1..1000).select {|x| (x % 3) == 0 && (x % 5) == 0}.inject(:+) | |
=> 33165 |
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
defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder |
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
#!/bin/bash | |
curl -d "url=www.myhomepage.com&page=validate&sealid=101&req_button=Positive&pageVersion=validationNewPage&test=1&urlBaseOn=%24urlBaseOn" "http://clicktoverify.truste.com/pvr.php?page=validate&url=www.myhomepage.com&sealid=101" >& /dev/null |
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
#!/bin/bash | |
ipad_preset_path="/Applications/Miro Video Converter.app/Contents/Resources/ffmpeg_presets/libx264-ipod640.ffpreset" | |
for filename in *.flv | |
do | |
echo "Converting video: $filename ... " | |
echo "Converting to mp4 ..." | |
ffmpeg -i "$filename" -threads 0 -strict experimental -f mp4 -vcodec libx264 -vpre slow -fpre "$ipad_preset_path" -b 1200k -acodec aac -ab 160000 -ac 2 "${filename%.*}.mp4" | |
echo "Done." |
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
#!/bin/bash | |
while true; do | |
echo "Checking git repository.." | |
date -u | |
git_status=`git pull` | |
if [[ $git_status != *up-to-date* ]]; then | |
growlnotify -m "Repository updated" -s | |
else | |
echo "no updates" |
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
if (Modernizr.video.h264) { | |
videoId = "#asd"; | |
video = VideoJS.setup(videoId); | |
video.play(); | |
} else { | |
videoUrl = 'KimAronson-TwentySeconds59483.flv'; | |
$f("player1", "flowplayer.swf", { | |
clip: { | |
url: videoUrl, | |
autoPlay: true, |