Skip to content

Instantly share code, notes, and snippets.

View tjosten's full-sized avatar

Timo Josten tjosten

View GitHub Profile
@tjosten
tjosten / audio.js
Last active December 15, 2015 19:19
HTML 5 <audio> & JavaScript
if (typeof Audio != "undefined") { // make sure the browser knows about <audio>
if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) { // firefox does not play .mp3 due to licensing issues
var audioFile = "sound.ogg";
} else {
var audioFile = "sound.mp3";
}
var audioTag = new Audio(audioFile);
audioTag.load(); // if you want the file to be loaded right now, use this. otherwise, use it before .play() but be aware that the playback will be delayed then, of course
Reload services menu manually with:
/System/Library/CoreServices/pbs -update
See if Dropshare is in the services directory:
/System/Library/CoreServices/pbs -dump_cache
Open Finder.app in debug mode, right-click on a file and navigate to "Services", see what debug messages are posted:
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@tjosten
tjosten / gist:fdefe25ee82bec69a560
Created July 9, 2015 11:01
Creating UITableViewCells with dynamic height based upon Auto Layout constraints with iOS 8
# pragma mark - Cell Setup
- (void)setUpCell:(DynamicTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
cell.label.text = [self.dataSource objectAtIndex:indexPath.row];
}
# pragma mark - UITableViewControllerDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
[
{
"group": "Lecture Tents",
"rooms": [
{
"slug": "tent-1",
"thumb": "http://localhost/streaming-website/thumbs/s1.png",
"link": "http://localhost/streaming-website/tent-1/",
"display": "Tent 1 (South)",
"streams": [