Skip to content

Instantly share code, notes, and snippets.

Avatar

Volodymyr Shatskyi vlad-shatskyi

View GitHub Profile
@vlad-shatskyi
vlad-shatskyi / notifyosd.zsh
Last active Dec 15, 2015 — forked from ihashacks/notifyosd.zsh
Displays a notification when a command, that takes over 10 seconds to execute, finishes and only if the current window isn't the terminal. Add to your .zshrc: [ -e path/to/notifyosd.zsh ] && . path/to/notifyosd.zsh
View notifyosd.zsh
function active-window-id {
echo `xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}'`
}
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
if [ ! -z "$cmd" ]; then
cmd_end=`date +%s`
((cmd_time=$cmd_end - $cmd_start))
fi
View teste.rb
user = User.find(1)
site = Site.new
site.url = "http://www.google.com"
site.name = "Google"
user.sites << site
if user.save
'cool'
View gist:4948332
File.foreach( "dictionary.txt" ) do |line|
md = line.match(/\A([A-Z]+)/)
puts md[0] if md
end
View index.html.erb
<table style="float: left; margin-left: 20px;">
<% if @user == current_user %>
<caption>My Holidays</caption>
<thead>
<tr>
<th>Start Date</th>
<th>End Date</th>
<th>Description</th>
<th>State</th>
<th>Type</th>
View _answer.html.erb
<li>
<%= ('a'.ord + answer_counter).chr >) <%= answer.content %>
</li>