Skip to content

Instantly share code, notes, and snippets.

View arufian's full-sized avatar
🌏
Working from home, cafe, hotel, etc

Alfian Busyro arufian

🌏
Working from home, cafe, hotel, etc
View GitHub Profile
@arufian
arufian / NSApplication+SelfRelaunch.m
Created November 27, 2012 02:13 — forked from cdfmr/NSApplication+SelfRelaunch.m
Self relaunch of Cocoa application
@implementation NSApplication (Relaunch)
- (void)relaunchAfterDelay:(float)seconds
{
NSTask *task = [[[NSTask alloc] init] autorelease];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"-c"];
[args addObject:[NSString stringWithFormat:@"sleep %f; open \"%@\"", seconds, [[NSBundle mainBundle] bundlePath]]];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:args];
global with sharing class CommonClass {
global List<Object> selectAllFromTable(String objectName, String whereCondition, String order, String limit1){
String query = selectAllQuery(objectName, whereCondition);
query += ' ORDER BY '+order+' LIMIT '+limit1;
try {
return database.query(query);
} catch (QueryException e){
//perform exception handling
System.debug('failed to selectAllFromTable');

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
trigger BookTrigger on Book__c (after insert, after update) {
BookTriggerHandler handler = new BookTriggerHandler();
if (Trigger.isBefore) {
// before trigger logic
} else if (Trigger.isAfter) {
if (Trigger.isInsert) {
// GoogleBooksAPIで書籍の情報を取得
handler.setGoogleBooksInfo(Trigger.new);