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
# git time log | |
# by NK | |
# usage "ruby git-timelog.rb" in git repository | |
# | |
# based on | |
# Simple Git Analyzer | |
# | |
# WORK IN PROGRESS :) | |
# | |
# Tobin Harris (tobin@tobinharris.com) |
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
#universal commands | |
task :shell do | |
system "echo 'logging into shell on server'" | |
system "ssh #{user}@#{domain} -t \"cd #{deploy_to}/current; bash --login\"" | |
end | |
task :log do | |
queue 'echo "Contents of the log file are as follows:"' | |
queue "cd #{deploy_to}/current && tail -f log/production.log -n 100" | |
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
#!/bin/bash | |
echo "commiting changes" | |
git add . | |
if [ "$1" != "" ]; then | |
git commit -am "$1" | |
else | |
echo "using empty comment" | |
git commit -am "-" | |
fi |
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
this.BENCHMARK = { | |
start_time: {}, | |
start: function(label) { | |
console.log("bm start: "+label) | |
this.start_time[label] = new Date().getTime() | |
}, | |
stop: function(label) { | |
past = new Date().getTime() - this.start_time[label] | |
console.log("bm stop: "+label+" "+past+"ms") | |
} |
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
/* | |
temperature meter | |
The circuit: | |
* LCD RS pin to digital pin 12 | |
* LCD Enable pin to digital pin 11 | |
* LCD D4 pin to digital pin 5 | |
* LCD D5 pin to digital pin 4 | |
* LCD D6 pin to digital pin 3 |
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
// example: <span class="with_spaces" data-parent="table" data-sum="input.unsold"></span> | |
sum_all = function(elements,callback) { | |
var sum = 0; | |
elements.each(function() { | |
if(!callback) { | |
var el_val = parseInt( ($(this).val() || $(this).html()).replace(/ /g,"")) || 0 | |
sum += el_val | |
} else { |
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
function call_soon(interval_id, callback, timeout) { | |
if(!timeout) { | |
timeout = 500 | |
} | |
clearTimeout(window[interval_id]) | |
window[interval_id] = setTimeout(callback,timeout) | |
} |
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
#supposed to copy paste lines from here to terminal | |
apt -y update | |
apt -y upgrade | |
#usefull packages | |
#removed libqt4-dev - breaking installation | |
apt -y install mlocate lynx libjemalloc-dev mc vim imagemagick libmagickwand-dev postgresql postgresql-contrib libpq-dev nginx curl git nodejs zip htop resolvconf | |
#for debian | |
apt -y install gnupg2 dirmngr sudo locate |
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
require 'mina/rails' | |
require 'mina/git' | |
# require 'mina/rbenv' # for rbenv support. (https://rbenv.org) | |
require 'mina/rvm' # for rvm support. (https://rvm.io) | |
# Basic settings: | |
# domain - The hostname to SSH to. | |
# deploy_to - Path to deploy into. | |
# repository - Git repo to clone from. (needed by mina/git) | |
# branch - Branch name to deploy. (needed by mina/git) |
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
function text_fit() { | |
$(".text-fit").each(function() { | |
var square = $(this).width()*$(this).height() | |
var chars = $(this).text().trim().length | |
var letter_square = square/chars; | |
var letter_height = Math.sqrt(letter_square)*4/3 | |
$(this).css({"line-height": letter_height+"px", "font-size": letter_height+"px"}) | |
}) |
OlderNewer