⌘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
from ftplib import FTP | |
### Clean up all the mac resource fork files starting with ._ on FTP | |
def main(): | |
f = FTP('121.199.122.95') | |
f.login('zsj2q1','e2d7t6c3') | |
print ('logging in') | |
clearDir(f,'htdocs') | |
f.close() | |
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
<?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']; |
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
<?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/> |
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/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' |
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
<?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. |
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
<?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; | |
} |
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
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 |
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
- (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; | |
} |
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/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) |
OlderNewer