Skip to content

Instantly share code, notes, and snippets.

View rugbyprof's full-sized avatar

Terry Griffin rugbyprof

View GitHub Profile
@rugbyprof
rugbyprof / backend.php
Last active August 29, 2015 14:04
Backend helper for mobile_web registration form helper.
<?php
error_reporting (0);
//debug or test backend.php by running the following commands from the browser:
//your.ip.address/backend.php?debug=true&action=select
//your.ip.address/backend.php?debug=true&action=login&[email protected]
//your.ip.address/backend.php?debug=true&action=busy&[email protected]
$fp = fopen("log.txt","a");
fwrite($fp,print_r($_POST,1)."\n");
@rugbyprof
rugbyprof / index.html
Created July 28, 2014 21:20
html5 skeleton
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="index, follow">
<title>Untitled</title>
<meta name="author" content="">
<meta name="description" content="">
@rugbyprof
rugbyprof / grade book starter
Created August 25, 2014 22:51
Create a beginning grade book from a summary list from banner.
<?php
//Get html from a summary email list on banner.
//If it's multiple pages, just append each page into one file
//
$file = file("student_emails.txt");
$fp = fopen("3013_distribution_list.csv","w");
fwrite($fp,"name,display name,email address\n");
for($i=0;$i<sizeof($file);$i++){
@rugbyprof
rugbyprof / create_csv.py
Last active February 14, 2020 02:13
create csv python
import csv
my_csv_file = open('/tmp/sample.csv', 'w')
csv_writer = csv.writer(my_csv_file)
sample_row = ('Michael', 1234, 23.46, 'San Francisco, California')
# Write a CSV row
csv_writer.writerow(sample_row)
# Result: Michael,1234,23.46,"San Francisco, California"
@rugbyprof
rugbyprof / file.swift
Last active February 14, 2020 02:14 — forked from frozzare/file.swift
swift example
import Foundation
class File {
class func exists (path: String) -> Bool {
return NSFileManager().fileExistsAtPath(path)
}
class func read (path: String, encoding: NSStringEncoding = NSUTF8StringEncoding) -> String? {
if File.exists(path) {
@rugbyprof
rugbyprof / youtubedl.mp3.sh
Last active September 21, 2017 07:59
youtube dl as mp3
youtube-dl --extract-audio --audio-format mp3 <video URL>
youtube-dl -i "<Youtube URL>" -o "%(title)s.%(ext)s" --extract-audio --audio-format "mp3" --audio-quality "192k"
@rugbyprof
rugbyprof / SimpleCoreLocationExample.swift
Last active February 14, 2020 02:13
core location example swift
import UIKit
import CoreLocation
class CurrentLocationViewController: UIViewController, CLLocationManagerDelegate {
let locationManager = CLLocationManager()
var location: CLLocation?
override func viewDidAppear() {
@rugbyprof
rugbyprof / convert-avi-mpg.php
Last active August 29, 2015 14:20
Convert directory of avi files to mpg.
<?php
// Usage: php convert-avi-mpg.php nameofdir
$dirName = $argv[1];
//Make sure directory has trailing slash
$dirName = rtrim($dir,"/");
$dir = scandir($dirName);
@rugbyprof
rugbyprof / ordered-list.swift
Created May 7, 2015 22:59
Simple ordered list function in swift. I know, there is a "sorted" or "sort" method. Just playing and learning.
var nums = [44,55,33,43,56,54,87,67,12,34,32,89]
println(nums[4])
func OrderedList(Nums:[Int])->[Int]{
var ONums:[Int] = []
for val in Nums{
@rugbyprof
rugbyprof / generate_letters.php
Created October 26, 2015 01:23
Create a set of letters with image magick and php
<?php
//convert -background white -fill black -font /Library/Fonts/Courier\ New\ Bold.ttf -pointsize 24 label:A -gravity center A.png
$sizes = array();
for($i=12;$i<=64;$i+=2){
$sizes[] = $i;
exec("mkdir letters_lower_{$i}");