NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
#!/bin/bash | |
# | |
# A basic script to configure a new personal machine and my development environment. | |
# Install: wget -q https://gist.github.com/dideler/6605525/raw/a5e83789254ee4c01937905a7398300386d2dd30/setup.sh -O - | sh | |
# | |
# Note that some stuff I use, such as fish, are typically installed via binaries. | |
# | |
# Don't forget to enable virtual desktops and two finger reverse scrolling! | |
# http://askubuntu.com/questions/260510/how-do-i-turn-on-workspaces-why-do-i-only-have-one-workspace-in-13-04 | |
# http://askubuntu.com/questions/91426/reverse-two-finger-scroll-direction |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
" Lets me know how much time I've spent editing a file | |
" Keyboard shortcut -> \dt | |
augroup TimeSpentEditing | |
au! | |
au BufWinEnter * if !exists('b:tstart')|let b:tstart=reltime()|en | |
augroup END | |
function! TimeSpentEditing() | |
let secs = str2nr(reltimestr(reltime(b:tstart))) | |
let hours = secs / 3600 |
/* Flatten das boostrap */ | |
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid { | |
-moz-box-shadow: none !important; | |
-webkit-box-shadow: none !important; | |
box-shadow: none !important; | |
-webkit-border-radius: 0px !important; | |
-moz-border-radius: 0px !important; | |
border-radius: 0px !important; | |
border-collapse: collapse !important; | |
background-image: none !important; |
Note: I'm currently taking a break from this course to focus on my studies so I can finally graduate
class A | |
{ | |
public: | |
int x; | |
protected: | |
int y; | |
private: | |
int z; | |
}; |
Snippets of code that I've played around with, which could be useful to others.
Nothing impressive, but you may learn a thing or two.
# Based on http://ejohn.org/blog/keeping-passwords-in-source-control/ | |
# | |
# John Resig needed a way to keep sensitive data (e.g. config files with | |
# passwords) out of source control. So he decided to encrypt the sensitive data. | |
# | |
# I decided to modify the script so it's purpose is quickly encrypting or | |
# decrypting any sensitive file you have on your computer. | |
# | |
# Usage: make encrypt | |
# make decrypt |
The program below can take one or more plain text files as input. It works with python2 and python3.
Let's say we have two files that may contain email addresses:
foo bar
ok [email protected] sup
[email protected],wyd
hello world!
#!/usr/bin/env python | |
import sys | |
filename = sys.argv[1] | |
# These do not remove \n | |
with open(filename) as f: | |
s = ''.join(f.readlines()) | |