Skip to content

Instantly share code, notes, and snippets.

public static String VIDEO_URL = "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear1/fileSequence0.ts";
private volatile byte[] videoBuffer;
private volatile VideoDownloadListener listener;
private volatile boolean isDownloading;
Runnable downloadVideoRunnable = new Runnable() {
@Override
public void run() {
try{
package com.jacks205.mediadatasourceexample;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import java.io.IOException;
//
// ViewController.swift
// CirclePieViewExample
//
// Created by Mark Jackson on 10/8/15.
// Copyright © 2015 Mark Jackson. All rights reserved.
//
import UIKit
//
// CirclePieView.swift
// CirclePieViewExample
//
// Created by Mark Jackson on 10/8/15.
// Copyright © 2015 Mark Jackson. All rights reserved.
//
import UIKit
//
// InflatingCircleIndicatorView.swift
// Spots
//
// Created by Mark Jackson on 9/24/15.
// Copyright © 2015 Mark Jackson. All rights reserved.
//
import UIKit
@jacks205
jacks205 / timeago.swift
Last active October 15, 2018 21:54 — forked from minorbug/timeago.swift
"Time ago" function for Swift (based on MatthewYork's DateTools for Objective-C) *Swift 2
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = NSCalendar.currentCalendar()
let now = NSDate()
let earliest = now.earlierDate(date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components([NSCalendarUnit.Minute , NSCalendarUnit.Hour , NSCalendarUnit.Day , NSCalendarUnit.WeekOfYear , NSCalendarUnit.Month , NSCalendarUnit.Year , NSCalendarUnit.Second], fromDate: earliest, toDate: latest, options: NSCalendarOptions())
if (components.year >= 2) {
return "\(components.year) years ago"
} else if (components.year >= 1){
@jacks205
jacks205 / XMLtoFile.cs
Created June 11, 2015 18:58
Write to XML File C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace JanteqTestConsoleApplication
{
public class Program
@jacks205
jacks205 / Constants.swift
Created May 6, 2015 00:05
Constants for Routes
//
// Constants.swift
// Routes
//
// Created by Mark Jackson on 3/21/15.
// Copyright (c) 2015 Mark Jackson. All rights reserved.
//
struct Constants{
//How to URL Encode string
CFURLCreateStringByAddingPercentEscapes(nil, str, nil, "!*'();:@&=+$,/?%#[]\" ", kCFStringEncodingASCII)
@jacks205
jacks205 / MapDirections.swift
Created April 6, 2015 07:29
MKMapKit showing route and zooming to show source and destination
//
// ViewController.swift
// MapDirections
//
// Created by Mark Jackson on 4/5/15.
// Copyright (c) 2015 Mark Jackson. All rights reserved.
//
import UIKit
import MapKit