Skip to content

Instantly share code, notes, and snippets.

View hakunin's full-sized avatar

Michal Hantl hakunin

  • Ostrava, Czech Republic
  • 10:54 (UTC -12:00)
View GitHub Profile
@acook
acook / keypress.rb
Created December 2, 2012 18:42
Read keypresses from user in terminal, including arrow keys using pure Ruby. This has since been folded into a much more robust gem called Remedy. https://rubygems.org/gems/remedy & https://github.com/acook/remedy
require 'io/console'
# Reads keypresses from the user including 2 and 3 escape character sequences.
def read_char
STDIN.echo = false
STDIN.raw!
input = STDIN.getc.chr
if input == "\e" then
input << STDIN.read_nonblock(3) rescue nil
@shadowhand
shadowhand / git-switchbranch
Created October 23, 2012 16:50
Fast git branch switcher
#!/bin/bash
usage() {
echo "usage: git switchbranch"
}
version() {
echo "switchbranch v0.0.2"
}
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@naaman
naaman / vim-on-heroku.sh
Last active July 6, 2023 13:50
vim on heroku
#!/usr/bin/env bash
mkdir vim
curl https://s3.amazonaws.com/heroku-vim/vim-7.3.tar.gz --location --silent | tar xz -C vim
export PATH=$PATH:/app/vim/bin
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@woodie
woodie / Message.java
Created March 30, 2011 19:03
Pagination in mirah/dubious
// Generated from message.mirah
// Also See: https://github.com/mirah/mirah_model/blob/master/src/model.mirah
package models;
public class Message extends com.google.appengine.ext.mirah.db.Model {
private java.lang.String title;
private java.util.Date published;
private java.lang.String link;
private java.lang.String summary;
private boolean is_reply;
private boolean is_featured;
<!DOCTYPE html>
<html>
<body>
<canvas id="c" style="width:500px; height:500px; background-color: grey">
</canvas>
<script>
@georgebrock
georgebrock / Rakefile
Created February 18, 2010 23:32
Rake tasks to manage Heroku deploys
namespace :deploy do
PRODUCTION_APP = 'myapp'
STAGING_APP = 'myapp-staging'
def run(*cmd)
system(*cmd)
raise "Command #{cmd.inspect} failed!" unless $?.success?
end
def confirm(message)
desc "Deploy to Heroku. Pass APP=appname to deploy to a different app"
task :deploy do
require 'heroku'
require 'heroku/command'
user, pass = File.read(File.expand_path("~/.heroku/credentials")).split("\n")
heroku = Heroku::Client.new(user, pass)
cmd = Heroku::Command::BaseWithApp.new([])
remotes = cmd.git_remotes(File.dirname(__FILE__) + "/../..")