⌘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 hidden or 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
import os | |
import sys | |
import sys | |
print sys.path |
This file contains hidden or 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
open('tuples.csv', 'w').write('\n'.join('%s %s' % x for x in your_lst)) | |
# suppose you have a lst of tuples like | |
# lst = [(item11, item12), (item21, item22), ...(item_n1, item_n2)] |
This file contains hidden or 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
import string | |
from random import sample, choice | |
chars = string.letters + string.digits | |
length = 8 | |
''.join(sample(chars,length)) # way 1 | |
''.join([choice(chars) for i in range(length)]) # way 2 |
This file contains hidden or 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
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g} | |
require File.join(File.dirname(__FILE__), "downmark_it") | |
module WordPress | |
def self.import(database, user, password, table_prefix = "wp", host = 'localhost') | |
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8') | |
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder} |
This file contains hidden or 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
Calendar cur_cal = new GregorianCalendar(); | |
cur_cal.setTimeInMillis(System.currentTimeMillis());//set the current time and date for this calendar | |
Calendar cal = new GregorianCalendar(); | |
cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR)); | |
cal.set(Calendar.HOUR_OF_DAY, 18); | |
cal.set(Calendar.MINUTE, 32); | |
cal.set(Calendar.SECOND, cur_cal.get(Calendar.SECOND)); | |
cal.set(Calendar.MILLISECOND, cur_cal.get(Calendar.MILLISECOND)); | |
cal.set(Calendar.DATE, cur_cal.get(Calendar.DATE)); |
NewerOlder