- replace current file with new file:
:e path/to/file
- undo:
u
- redo:
ctrl r
- increment/decrement number:
CTRL A
,CTRL X
- change case:
~
- change case of full word:
viw~
- join two lines:
J
- fix line indent:
==
- indent/unindent block (vis m):
>
/<
/5<
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pop one commit from remote master | |
# '+' pushes with force | |
git push origin +HEAD^:master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
bool foo = false; | |
Console.WriteLine("foo 1: "); | |
Console.WriteLine(foo); | |
changeFoo(ref foo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin mobile-only--height { | |
@media (max-height: 635px) and (min-width: 642px) and (max-width: 1440px) { @content; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// javascript's foreach is cool | |
let arr = new Array(); | |
for (let i = 0; i < 5; i++){ | |
arr.push(i); | |
} | |
arr.foreach(function(item){ | |
console.log(item); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm $(git ls-file --deleted); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep "4294" -B 3 -A 3 | |
grep -r "foo" . | |
# -H causes the filename to be printed (implied when multiple files are searched) | |
# -r does a recursive search | |
# -n causes the line number to be printed | |
# -I ignore binary files (complement: -a treat all files as text) | |
# -F treat search term as a literal, not a regular expression | |
# -i do a case-insensitive search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo chown -R $USER ~/projects/kaa-api/log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rails 2.3.5 | |
p = Promotion.find(:first, :conditions => ["subdomain = ?", "foobar"]) | |
# to find based on multiple conditions based on multiple associations | |
User.find(:all, :include => [:contact, :promotion], :conditions => ['contacts.email = ? and promotions.id = ?', 'marcuss@hesonline.com', 22]) | |
# to find last record in old rails apps, rails 2 | |
p = Promotion.find(:all, :order => "id desc", :limit => 1) # newest first | |
# and in ascending order | |
p = Promotion.find(:all, :order => "id asc", :limit => 1) # oldest first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to install diff Ruby verison | |
rvm install ruby-1.8.7-head | |
# to force RVM to use a diff Ruby version by default | |
rvm --default use 1.8.7 | |
# to create a new rvm enviornment | |
rvm use 1.8.7@foo --create | |
# to install the package that will interate over |