Skip to content

Instantly share code, notes, and snippets.

@Lizdo
Lizdo / gist:3016360
Created June 29, 2012 06:53 — forked from msluyter/gist:1925069
Sublime Text 2 - Useful Shortcuts

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
@Lizdo
Lizdo / gist:3016359
Created June 29, 2012 06:53 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
#! /usr/bin/python
### Convert Audio for iPhone Project
import os.path
import subprocess
import shutil
def main():
dir = '/Users/Liz/Dropbox/Projects/BoardGame/Sound'
files = os.listdir(dir)
os.chdir(dir)
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *hitView = [super hitTest:point withEvent:event];
if (hitView == self)
//non of my subView's bounds are hit, and I'm transparent
return nil;
else
return hitView;
}
on idle
tell application "System Events"
tell current location of network preferences
set myConnection to the service "VPN (PPTP)"
if current configuration of myConnection is not connected then
connect myConnection
end if
end tell
return 120
end tell
<?php
$style = '';
$userid_array = $wp_user_search->get_results();
foreach ($userid_array as $userid ) {
$user_object = new WP_User($userid);
$roles = $user_object->roles;
$role = array_shift($roles);
$userobject_array[] = $user_object;
}
<?php
function post_image($post, $targetwidth = 100, $targetheight = 100, $resize = true){
$key="post-image";
$post_image = get_post_meta($post->ID, $key, true);
if ($post_image != null) {
//get image size
$width = get_post_meta($post->ID, "post-image-width", true);
$height = get_post_meta($post->ID, "post-image-height", true);
if ($width == null || $height == null){
//only calculates the size for the first time.
#! /usr/bin/python
### Copy everything on a FTP server to a local folder
from ftplib import FTP
import os.path
import datetime
def main():
#fill in the parameters here
ftpaddress = '1.1.1.1'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.lizdo.ftpbackupweekly.plist</string>
<key>Program</key>
<string>/Users/Liz/Library/Scripts/FTPAutoBackup.php</string>
<key>LowPriorityIO</key>
<true/>
<?php
function elbe_current_user_can($capability, $current_user) {
//replace wp2_ with your database prefix -.-
$roles = get_option('wp2_user_roles');
$user_roles = $current_user->wp_capabilities;
if ($user_roles == null)
return false;
$user_roles = array_keys($user_roles, true);
$role = $user_roles[0];
$capabilities = $roles[$role]['capabilities'];