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
#!/bin/bash | |
#By Nate Flink | |
#Invoke on the terminal like this | |
#curl -s https://gist.github.com/nateflink/9056302/raw/findreplaceosx.sh | bash -s "find-a-url.com" "replace-a-url.com" | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
echo "Usage: ./$0 [find string] [replace string]" | |
exit 1 | |
fi |
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
cat <<EOF | sendmail -t | |
To: [email protected] | |
Subject: Testing | |
From: [email protected] | |
This is a test message | |
EOF |
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
static inline NSString *hexFromUIColor(UIColor * _color) { | |
if (CGColorGetNumberOfComponents(_color.CGColor) < 4) { | |
const CGFloat *components = CGColorGetComponents(_color.CGColor); | |
_color = [UIColor colorWithRed:components[0] green:components[0] blue:components[0] alpha:components[1]]; | |
} | |
if (CGColorSpaceGetModel(CGColorGetColorSpace(_color.CGColor)) != kCGColorSpaceModelRGB) { | |
return [NSString stringWithFormat:@"#FFFFFF"]; | |
} | |
return [NSString stringWithFormat:@"#%02X%02X%02X", (int)((CGColorGetComponents(_color.CGColor))[0]*255.0), (int)((CGColorGetComponents(_color.CGColor))[1]*255.0), (int)((CGColorGetComponents(_color.CGColor))[2]*255.0)]; | |
} |
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
static inline BOOL IsEmpty(id thing) { return thing == nil || ([thing respondsToSelector:@selector(length)] && [(NSData *)thing length] == 0) || ([thing respondsToSelector:@selector(count)] && [(NSArray *)thing count] == 0); } |
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
//RGB color macro | |
#define UIColorFromRGB(rgbValue) [UIColor \ colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] | |
//RGB color macro with alpha | |
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \ colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ blue:((float)(rgbValue & 0xFF))/255.0 alpha:a] |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Web</title> | |
<link rel="stylesheet" href="css/style.css"> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<style> |
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
#!/bin/bash | |
WPPATH=$1 | |
REMOTE_WPPATH=$2 | |
SSH_USER=$3 | |
SSH_URL=$4 | |
LOCAL_HOSTNAME=$5 | |
REMOTE_HOSTNAME=$6 |
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
#!/bin/bash | |
#By Nate Flink | |
# | |
# get the wp-config mysql variables | |
# | |
DIRPATH=$1 | |
VAR=$(curl -s https://gist.github.com/nateflink/06c5f5f99002374fe628/raw/readwpconfig.sh | bash -s "${DIRPATH}/wp-config.php") | |
STATUS=$?; [[ $STATUS == 0 ]] || { echo "${0} line:${LINENO} exit:$STATUS ${VAR}"; exit 1; } |
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
#!/bin/bash | |
#By Nate Flink | |
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then | |
echo "Usage: ./$0 [path to files] [find string] [replace string]" | |
exit 1 | |
fi | |
DIRPATH=$1 | |
FIND=$2 |