Skip to content

Instantly share code, notes, and snippets.

View artofhuman's full-sized avatar

Semyon Pupkov artofhuman

View GitHub Profile
@artofhuman
artofhuman / gist:3737042
Created September 17, 2012 12:35 — forked from armonge/gist:2830057
django youtube field
import urlparse
import re
from django.db import models
from django import forms
def validate_youtube_url(value):
'''El patron lo saque de http://stackoverflow.com/questions/2964678/jquery-youtube-url-validation-with-regex'''
pattern = r'^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=\w+)(?:\S+)?$'
@artofhuman
artofhuman / vim.rb
Created October 13, 2012 18:38 — forked from mgrouchy/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :revision => '6c318419e331'
version '7.3.515'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end
@artofhuman
artofhuman / gist:4007265
Created November 3, 2012 12:48 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
block goods {
tag: 'ul'
content: {
var content = [];
this.ctx.goods.forEach(function(item){
var mods = {};
@artofhuman
artofhuman / vim.rb
Created December 27, 2012 18:36 — forked from voldmar/vim.rb
# To use this recipe you have to:
# $ brew install python --framework
# $ mkdir ~/Frameworks
# $ ln -s "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework" ~/Frameworks
# $ brew install ./vim.rb
require 'formula'
require 'open-uri'
class Vim < Formula
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# 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
@import "active_admin/mixins"
@import "active_admin/components/links"
body
@include global-reset
@import "active_admin/typography"
@import "active_admin/header"
@import "active_admin/forms"
@import "active_admin/components/comments"
@import "active_admin/components/flash_messages"

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
#!/bin/bash
# Update and upgrade packages
sudo apt-get update && sudo apt-get upgrade
# Install postgres 9.3
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
# Having Postgres 9.2 already, this will create database instance configured to run on port 5433