⌘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
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)); |
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
%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 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 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 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 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
def get_loc_data(self): | |
return [x for x in self.numeric_lst if x[9] == 0] | |
def get_sit_data(self): | |
return [x for x in self.numeric_lst if x[9] == 1] | |
def get_bluetooth_data(self): | |
return [x for x in self.numeric_lst if x[9] == 2] | |
def get_location(self, idx): | |
return self.name_map['loc'][idx] |
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
public void unrequestAllData2(DataListener listener){ | |
Map<IJsonObject,List<DataRequestInfo>> changedEntrySet = new HashMap<IJsonObject, List<DataRequestInfo>>(); | |
synchronized (dataRequests) { | |
for (Entry<IJsonObject,List<DataRequestInfo>> entry : dataRequests.entrySet()) { | |
IJsonObject probeConfig = entry.getKey(); | |
List<DataRequestInfo> dataRequestInfos = entry.getValue(); | |
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
curl http://packages.ubuntu.com/quantal/all/texlive-fonts-recommended/filelist | sed -En 's!/usr/share/texlive/texmf-dist/fonts/tfm/.*/([^/]+)/[^/]+\.tfm$!\1!p' |
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
*.aux | |
*.glo | |
*.idx | |
*.log | |
*.toc | |
*.ist | |
*.acn | |
*.acr | |
*.alg | |
*.bbl |
OlderNewer