Skip to content

Instantly share code, notes, and snippets.

View madis's full-sized avatar
🧑‍💻
code mode

Madis Nõmme madis

🧑‍💻
code mode
View GitHub Profile
@madis
madis / vim_findings.md
Created October 4, 2012 09:09
Vim findings

Line navigation

  • k - up
  • j - down
  • h - left
  • l - right

Current line, go to:

  • 0 - start
  • ^ - firs non-blank character
@madis
madis / gist:4067411
Last active October 12, 2015 18:18
Sublime tips
  • crtl+cmd+g - select matching text
  • crtl+m - jump to matching bracket
  • crtl+left/right - move cursor left / right word segment
  • crtl+k+d - discard current selection and create a cursor at the next
@madis
madis / gist:4101315
Created November 17, 2012 23:19
TextMate findings

Create ctags file for SublimeText containing current floder + used gemsets - ctags --extra=+f --exclude=.git --exclude=log -f .tags -R . `rvm gemdir`/gems/*

@madis
madis / gist:4126822
Created November 21, 2012 18:47
prompt with git additions
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
DARK_GRAY="\[\033[0;90m\]"
COLOR_NONE="\[\e[0m\]"
```bash
# Make a POST request with post parameter
# -i for showing headers
# -d for passing post parameters
curl -i -d "site_key=almost_random" -X POST http://localhost:3001/api/visits
# Save a cookie in a file
curl -c visits_cookie.txt -d "site_key=almost_random" -X POST http://localhost:3001/api/visits
# Make a POST request with cookie
@madis
madis / redis-server
Last active December 11, 2015 12:49
init.d script for starting redis server. Provides start/stop/reload/status
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@madis
madis / javascript_debugging.js
Created February 12, 2013 16:56
Javascript debugging
// Creating a script tag & adding it to page
jCookie=document.createElement('script');
jCookie.type = 'text/javascript';
jCookie.src = "https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js";
$('body').append(jCookie)
@madis
madis / useful_postgres_snippets.md
Last active December 13, 2015 21:48
Postgres administration & other useful snippets
@madis
madis / coffeescript_inheritance.coffee
Created March 11, 2013 21:45
Playing with coffeescript inheritance
class Base
@doSomething: (@origin) ->
console.log "Base.doSomething called"
@showSomething: ->
console.log "Showing something", @things
@createSomething: (something) ->
new @
@madis
madis / install_ruby_2.0.0.sh
Created July 20, 2013 12:56
Installing Ruby 2 with openssl libraries linking issue
# Will get you past the ssl library linking issue
rvm pkg install openssl
rvm install --autolibs=packages --with-openssl-dir=$HOME/.rvm/usr 2.0.0