Skip to content

Instantly share code, notes, and snippets.

View mislav's full-sized avatar

Mislav Marohnić mislav

View GitHub Profile
@mislav
mislav / gist:58799
Created February 5, 2009 16:23 — forked from rails/gist:58761
Update contents of elements with relative times
document.observe("dom:loaded", function() {
function updateElementsWithTime() {
$$("span[time]").invoke('updateTime')
}
// update immediately
updateElementsWithTime()
// continue updating every 2 minutes
new PeriodicalExecuter(updateElementsWithTime, 60 * 2)
})
@mislav
mislav / quiz.rb
Created May 15, 2009 18:18 — forked from ryanb/quiz.rb
Ryan Bates community challenge solution
# COMMUNITY CHALLENGE
#
# How would you test this Quiz#problem method? Only two rules:
#
# 1. You must test the order the gets/puts happen. The tests should not
# still pass if "gets" happens before "puts", etc.
#
# 2. No changing the Quiz class implementation/structure. But you can
# use whatever framework you want for the tests.
#
@mislav
mislav / twitter spammer.md
Created June 11, 2009 11:20 — forked from svenfuchs/What makes you a Twitter spammer?
What makes you a Twitter spammer?

Blocky (@blocky_bot) is a crowdsourcing solution for Twitter spam. Blocky does not define what a "spammer" is, so let's discuss.

What makes you a Twitter spammer?

  • You follow me just to make me follow you.

    It all comes down to this. Spammers can't spam if nobody follows them. Any relatively new account that already follows hundreds or thousands of people

@mislav
mislav / survey
Created November 1, 2009 11:27 — forked from radar/survey.md
What did you do to get good at Rails?
Read source code, wrote plugins
Who taught you what you know?
Josh Susser! (about ActiveRecord)
Do you have any fond (or not so fond) memories of your learning experiences?
@mislav
mislav / description.txt
Created December 17, 2009 23:01 — forked from sprsquish/gist:259067
git workflow with peer review on topic branches
so my workflow is that each ticket gets a branch. Before merging the branch to master
it needs to be peer-reviewed. So sometimes I have a bunch of branches that are off
being reviewed while I work on something else.
Currently when I run "git branch" I see:
[branch 1]
[branch 2]
[branch 3]
*[branch 4]
[branch 5]
@mislav
mislav / git-amend.sh
Created January 16, 2010 13:43 — forked from nachof/git-amend.sh
git amend command
#!/usr/bin/env bash
git status >/dev/null
if [ $? -ne 0 ]; then
echo "Nothing to commit. Use git add first"
exit 1
fi
TARGET=$1
BRANCH=$(git name-rev HEAD | cut -d' ' -f2)
@mislav
mislav / hoptoad_api.rb
Created April 22, 2010 22:59 — forked from croaky/hoptoad_api.rb
Active Resource model for Hoptoad
require 'active_resource'
ActiveResource::Base.class_eval do
private
alias original_find_or_create_resource_for find_or_create_resource_for
# names like "foo.bar" become "foo_bar" so constants lookup doesn't barf
def find_or_create_resource_for(name)
original_find_or_create_resource_for name.to_s.gsub('.', '_')
@mislav
mislav / ghi.rb
Created April 27, 2010 19:25 — forked from marksands/ghi.rb
GitHub Issues power script
#!/usr/bin/env ruby
require "rubygems"
require "mutter"
require "httparty"
REMOTE = "origin"
REPO = `git config --get remote.#{REMOTE}.url`.chomp[/github\.com[\/\:]([^\/]+\/[^\/]+)\.git/, 1]
USER = `git config --get github.user`.chomp
TOKEN = `git config --get github.token`.chomp
@mislav
mislav / git-github-issues.rb
Created May 6, 2012 18:04 — forked from gorenje/feature_branch.rb
hub extension command
#!/usr/bin/env ruby -w
require 'net/https'
require 'json'
unless `git config --get-all remote.origin.url` =~ %r{\bgithub\.com[:/]([^/\s]+)/([^/\s]+)}
abort "no GitHub URL found in origin remote"
end
owner = $1
repo = $2.sub(/\.git$/, '')
@mislav
mislav / log.txt
Created August 19, 2012 13:39 — forked from steveklabnik/log.txt
Analyze shell history; zsh edition + alias expansion
480 git commit -v
397 git status -sb
120 git add -p
53 git push
52 git diff
47 noglob bundle exec
45 ls -G
45 git branch -v
45 bundle
39 git push -u