⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
cd /tmp | |
git clone git://git.kernel.org/pub/scm/git/git.git | |
cd git | |
git checkout v`git --version | awk '{print $3}'` | |
cp contrib/completion/git-completion.bash ~/.git-completion.bash | |
cd ~ | |
rm -rf /tmp/git | |
echo -e "source ~/.git-completion.bash" >> .profile |
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
// add the filter to your application module | |
angular.module('yourAppName', ['filters']); | |
/** | |
* Truncate Filter | |
* @Param string | |
* @Param int, default = 10 | |
* @Param string, default = "..." | |
* @return string | |
*/ |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
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
var net = require('net'), | |
sys = require('sys'); | |
function WSServer(port, ip) { | |
if(!port) throw('You should assign a port to listen.'); | |
this.port = port; | |
this.ip = ip||'127.0.0.1'; | |
this.server = null; | |
var clients = {}; | |
var state = { |
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
from django.core.exceptions import MiddlewareNotUsed | |
from django.conf import settings | |
import cProfile | |
import pstats | |
import marshal | |
from cStringIO import StringIO | |
class ProfileMiddleware(object): | |
def __init__(self): | |
if not settings.DEBUG: |
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
from django.test.simple import DjangoTestSuiteRunner | |
from django.test import TransactionTestCase | |
from mongoengine import connect | |
class TestRunner(DjangoTestSuiteRunner): | |
def setup_databases(self, **kwangs): | |
db_name = 'testsuite' | |
connect(db_name) | |
print 'Creating test-database: ' + db_name |
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
#!/usr/bin/env ruby | |
require 'faraday' | |
require 'json' | |
require 'gitlab' | |
module Redmine | |
Host = nil | |
APIKey = nil |
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
MongoDB upstart scripts for Ubuntu. | |
Run following commands after installing upstart scripts: | |
ln -s /lib/init/upstart-job /etc/init.d/mongoconf | |
ln -s /lib/init/upstart-job /etc/init.d/mongodb | |
ln -s /lib/init/upstart-job /etc/init.d/mongos | |
To start services use: |
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
# Stolen from http://paste.pocoo.org/show/224441/ | |
from pymongo.cursor import Cursor | |
from pymongo.connection import Connection | |
from pymongo.errors import AutoReconnect | |
from time import sleep | |
def reconnect(f): | |
def f_retry(*args, **kwargs): |
OlderNewer