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 RetinaFinder | |
PATH_TO_NORMAL = "app/assets/images/" | |
PATH_TO_RETINA = "app/assets/images/2x/" | |
IMAGE_FORMATS = %w(png jpg gif) | |
MULTIPLIER = 4 # 2 for regular retina, 4 for retina + 2x zoom, etc. | |
def run | |
build_file_lists | |
match_files | |
report_missing_or_orphaned |
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 Sequelize = require('sequelize'); | |
// Set up database connection | |
var sql = new Sequelize('database', 'root', '', { | |
dialect: 'mysql' | |
}); | |
// Global counter | |
var counter = 0; |
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
*Device* *Portrait* *Landscape* *Device type* *Remarks* | |
Nexus 7 600 961 Tablet | |
iPad 2 768 768 Tablet iOS always reports the same, regardless of orientation. | |
Surface RT 1366 1024 Tablet | |
Galaxy Tab 2 1280 800 Tablet | |
Galaxy Nexus 360 598 Phone | |
iPhone 5 320 320 Phone iOS always reports the same, regardless of orientation. | |
Galaxy S3 mini 320 534 Phone Stock android browser reports 533, not 534 (Chrome). |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>viewport test</title> | |
<meta name="viewport" id="viewport" content="width=device-width"> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<span id="width"></span> x <span id="height"></span> |
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
after "deploy:restart", "deploy:cleanup" | |
namespace :deploy do | |
task :restart, :roles => :web do | |
run "touch #{release_path}/tmp/restart.txt" | |
end | |
task :finalize_update, :roles => :web do | |
run "RAILS_ENV=#{rails_env}" | |
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 hasFlash = false; | |
var hasSilverlight = false; | |
try { | |
hasFlash = !!((typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") || (window.ActiveXObject && (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) !== false)); | |
} catch(err) { | |
hasFlash = false; | |
} | |
try { |
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
/* | |
* BoxBlurFilter | |
* Visit http://createjs.com/ for documentation, updates and examples. | |
* | |
* Adapted by Hiro to function as a standalone web worker. Pass it a | |
* message with a data object supplying ImageData, a radius and quality | |
* (number of passes). Returns a message with the resulting | |
* blurred ImageData. | |
* | |
* |
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 http = require('http'); | |
http.createServer(function (req, res) { | |
var postedData = ''; | |
req.on('data', function(data) { postedData += data.toString(); }); | |
req.on('end', function() { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end(postedData); | |
console.log(postedData); | |
}); | |
}).listen(8080, '127.0.0.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
pid1 = spawn "some_command" | |
pid2 = spawn "some_other_command" | |
pid1.on_exit do |status| | |
puts "Process #1 exited with status code #{status}, aborting." | |
exit | |
end | |
pid2.on_exit do |status| | |
puts "Process #2 exited with status code #{status}, aborting." |
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 child_process = require('child_process'); | |
job1 = child_process.spawn('sleep', ['5']) | |
job2 = child_process.spawn('sleep', ['10']) | |
job1.on('exit', function(code, signal) { | |
console.log("Job 1 exited with code " + code + " and signal " + signal); | |
job2.kill(); // Send SIGTERM to other job | |
}) |
OlderNewer