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
// Construct startDate and endDate objects with NSDateComponents. | |
// See this article for more http://iaintheindie.com/2014/08/08/useful-nsdate-nscalendar-tricks/#StartEnd_of_the_Week | |
// For more examples of working with HealthKit see https://developer.apple.com/library/content/samplecode/Fit/Introduction/Intro.html | |
let workoutPredicate = NSPredicate(format: "(%K == %d) OR (%K == %d)", | |
HKPredicateKeyPathWorkoutType, | |
HKWorkoutActivityType.functionalStrengthTraining.rawValue, | |
HKPredicateKeyPathWorkoutType, | |
HKWorkoutActivityType.traditionalStrengthTraining.rawValue) |
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 numpy | |
import decimal | |
items = [decimal.Decimal(x) for x in range(0, 20)] | |
array = numpy.array(items, dtype=decimal.Decimal) | |
array.mean() | |
# OS X, python 2.7.6: | |
# Traceback (most recent call last): | |
# File "<stdin>", line 1, in <module> |
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
#!/bin/sh | |
# | |
# nginx - this script starts and stops the nginx daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server | |
# processname: nginx | |
# config: /etc/nginx/nginx.conf | |
# config: /etc/sysconfig/nginx |
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 UIKit | |
import Dispatch | |
struct PromptToast { | |
static let ErrorMessageDisplayDuration = 5.2 | |
} | |
extension UIViewController { | |
func toast(message: String, duration: Double) { | |
/* Make sure we have a navigation controller */ |
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
#!/bin/bash | |
count=1 | |
files="$(ls)" | |
for X in $files | |
do | |
mv $X "prefix${count}.filetype" | |
count=$((count+1)) | |
done |
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/env ruby | |
require 'raspell' | |
class CommentSpellCheck | |
SP = Aspell.new("en") #initialize our spell checker | |
SP.suggestion_mode = Aspell::NORMAL | |
SP.set_option("ignore-case", "false") #case sensitivity is important to us | |
# Regex to find text within documentation code comments, not plain // comments or regular block comments /* */. Only /** */ comments | |
@@comment_regex = /\/\*([\w\d\W\D]+?)\*\// |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
</head> | |
<body> | |
<p>Check out these links for more info about me and what I do:<br> |
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
#cd /Path/To/Repo | |
rm status.txt | |
touch status.txt | |
git status >> status.txt | |
echo '' >> status.txt | |
git log --since='08:00 yesterday' --until='20:00 yesterday' >> status.txt | |
open status.txt -e |
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
static NSString *getAppNameAndVersionNumber() { | |
NSString *number = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; | |
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; | |
NSString *nameAndVersion = [NSString stringWithFormat:@"%@_%@", appName, number]; | |
return nameAndVersion; | |
} |