Skip to content

Instantly share code, notes, and snippets.

@potomak
potomak / connected_actual.log
Created November 27, 2013 18:09
FB.getLoginStatus Chromium error
FB.getLoginStatus Object {authResponse: undefined, status: "unknown"}
FB.login Object {authResponse: Object, status: "connected"}
@potomak
potomak / notify_url_change.rb
Created October 11, 2013 12:12
Get a notification when the NodeKO registration opens.
require 'eventmachine'
require 'em-http-request'
EM.run {
timer = EM::PeriodicTimer.new(60) do
http = EM::HttpRequest.new('http://nodeknockout.com/teams/new').get
http.errback {
puts 'Uh oh'
}
gem 'rails-api'
gem 'active_model_serializers'
gem_group :development, :test do
gem 'debugger'
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'factory_girl_rails'
end
@potomak
potomak / jitsu_users_confirm.out
Created July 10, 2012 21:09
Nodejitsu account confirmation
giovanni@thinkpad:~$ jitsu users confirm potomak XXX
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command users confirm potomak XXX
info: Confirming user potomak
info: Great success! potomak is now confirmed.
info: User potomak confirmed
info: Would you like to log in now?
prompt: (yes/no): (yes)
info: Attempting to log in as potomak
@potomak
potomak / _flash.html.erb
Created January 12, 2012 14:35
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@potomak
potomak / voices.sh
Created November 29, 2011 14:14
Listen to all the voices of your PC
#!/bin/sh
for i in $(ls -r -t /System/Library/Speech/Voices/ | awk -F'.' '{print $1}'); do
echo $i
say -v $i "Hi, I'm $i"
done
@potomak
potomak / terminal_ansicolors.rb
Created October 24, 2011 08:23
Testing terminal colors
require 'rubygems'
require 'term/ansicolor'
COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
class String
include Term::ANSIColor
end
(0..15).each do |x|
@potomak
potomak / git_colors.sh
Created September 21, 2011 12:54
Git colors
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
@potomak
potomak / do_it.rb
Created August 5, 2011 15:37
Download all photos from Corso12
require 'open-uri'
(1..700).each do |factor|
threads = []
(1..100).each do |id|
threads << Thread.new(id+100*factor) { |image_id|
log = "#{image_id} opening image... "
begin