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
| t = 236 # seconds | |
| Time.at(t).utc.strftime("%H:%M:%S") | |
| => "00:03:56" | |
| # Reference | |
| # http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
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
| /* Drag'n drop stuff */ | |
| var drag = document.getElementById("drag"); | |
| drag.ondragover = function(e) {e.preventDefault()} | |
| drag.ondrop = function(e) { | |
| e.preventDefault(); | |
| var length = e.dataTransfer.items.length; | |
| for (var i = 0; i < length; i++) { | |
| var entry = e.dataTransfer.items[i].webkitGetAsEntry(); | |
| var file = e.dataTransfer.files[i]; |
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
| # http://www.dzone.com/snippets/build-hash-tree-array-file | |
| Dir["**/*"].inject({}) {|h,i| t = h; i.split("/").each {|n| t[n] ||= {}; t = t[n]}; h} |
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 class="tabs"> | |
| <div class="tab"><div class="tab-box"></div></div> | |
| <div class="tab"><div class="tab-box"></div></div> | |
| <div class="tab active"><div class="tab-box"></div></div> | |
| <div class="tab"><div class="tab-box"></div></div> | |
| </div> | |
| <div class="content"> | |
| </div> |
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/python | |
| # CLI program to control the mediakeys on OS X. Used to emulate the mediakey on a keyboard with no such keys. | |
| # Easiest used in combination with a launcher/trigger software such as Quicksilver. | |
| # Main part taken from http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac | |
| # Glue to make it into cli program by Fredrik Wallner http://www.wallner.nu/fredrik/ | |
| import Quartz | |
| import sys |
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
| # Disallow site indexing in non-production environments | |
| config.middleware.insert_before(::Rack::Lock, '::Rack::Robots') |
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 new service in automator | |
| -- set input to "no input" instead of "text" | |
| -- add new task: run applescript | |
| on run {input, parameters} | |
| tell application "Finder" | |
| activate | |
| set new_window to make new Finder window | |
| end tell | |
| end run |
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
| [Unit] | |
| Description=Start Herir Node.js Service | |
| Requires=network.target | |
| After=network.target | |
| [Service] | |
| Type=forking | |
| WorkingDirectory=/srv/hereir/node | |
| ExecStart=/usr/bin/forever start --pidFile /var/run/hereir.pid HereIR.js | |
| ExecStop=/usr/bin/forever stop HereIR.js |
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
| namespace :deploy do | |
| namespace :sidekiq do | |
| desc 'Replace upstart config for sidekiq-workers' | |
| task :upstart_config do | |
| data = %Q{ | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| exec su - #{user} -c 'cd #{release_path}; export RAILS_ENV=#{stage}; bundle exec sidekiq -q default,1 -c 4 -pid #{release_path}/tmp/pids/sidekiq.pid >> #{release_path}/log/sidekiq.log 2>&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
| using UnityEngine; | |
| using System.Collections; | |
| public class MonoBehaviourSingleton<T> : MonoBehaviour | |
| where T : Component | |
| { | |
| private static T _instance; | |
| public static T Instance { | |
| get { | |
| if (_instance == null) { |