Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

task :console do
require 'irb'
require 'irb/completion'
require 'your_gem'
ARGV.clear
IRB.start
end
package main
import (
"fmt"
"strings"
)
type Position struct {
X, Y int
}
@kavu
kavu / file_watcher.go
Created April 6, 2014 19:02
One day @gamesbrainiac asked me to make a simple File Watcher on Go…
package main
import (
"log"
"os"
"path/filepath"
"time"
)
type pathsModTimes map[string]time.Time
@kavu
kavu / keybase.md
Created April 12, 2014 19:18
Keybase Proof

Keybase proof

I hereby claim:

  • I am kavu on github.
  • I am kavu (https://keybase.io/kavu) on keybase.
  • I have a public key whose fingerprint is F7F6 71A8 090C 7938 AB8E 84E2 8331 E923 9463 166D

To claim this, I am signing this object:

@kavu
kavu / go.txt
Last active August 29, 2015 14:15
Go Resources
https://golang.org/doc/articles/wiki/
http://learnxinyminutes.com/docs/go/
http://codegangsta.gitbooks.io/building-web-apps-with-go/content/
http://dave.cheney.net/resources-for-new-go-programmers
http://www.golang-book.com/
http://golang.org/doc/effective_go.html
http://tour.golang.org/#1
http://golang.org/ref/spec
http://www.miek.nl/projects/learninggo/
https://gobyexample.com/
CmdUtils.CreateCommand({
name: "flip",
execute: function(){
var doc = CmdUtils.getDocument();
jQuery(doc.body).css("-moz-transform", "rotate(180deg)");
}
});
CmdUtils.CreateCommand({
@kavu
kavu / chat.rb
Created July 10, 2009 22:53 — forked from maxlapshin/chat.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'active_support'
require 'haml'
require 'thin'
gem 'tmm1-amqp'
require 'mq'
@kavu
kavu / gist:175837
Created August 26, 2009 20:58 — forked from skammer/gist:175684
// replaced this
$(document).ready(function() {
if ($.fn.corner) $('.corner').corner()
})
// with this
.corner {
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
padding: 3px;
@kavu
kavu / deploy.rb
Created November 18, 2009 10:58 — forked from kpumuk/deploy.rb
namespace :deploy do
desc 'Bundle and minify the JS and CSS files'
task :precache_assets, :roles => :app do
root_path = File.expand_path(File.dirname(__FILE__) + '/..')
jammit_path = Dir["#{root_path}/vendor/gems/jammit-*/bin/jammit"].first
yui_lib_path = Dir["#{root_path}/vendor/gems/yui-compressor-*/lib"].first
assets_path = "#{root_path}/public/assets"
# Precaching assets
run_locally "ruby -I#{yui_lib_path} #{jammit_path}"
it 'should allow JPG images' do
photo = Photo.new :photo => fixture_file_upload('photos/chameleon.jpg', 'image/jpeg')
photo.stub!(:save_attached_files).and_return true
photo.save.should be_true
end