Skip to content

Instantly share code, notes, and snippets.

@dahnielson
dahnielson / UUID.php
Last active January 14, 2025 05:54
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@fracasula
fracasula / getMp3StreamTitle.php
Last active January 25, 2025 20:13
How to get the MP3 metadata (StreamTitle) from a streaming URL
<?php
/**
* Please be aware. This gist requires at least PHP 5.4 to run correctly.
* Otherwise consider downgrading the $opts array code to the classic "array" syntax.
*/
function getMp3StreamTitle($streamingUrl, $interval, $offset = 0, $headers = true)
{
$needle = 'StreamTitle=';
$ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36';
@briandw
briandw / RLArrowView.m
Created June 24, 2013 16:54
rantlab 1 full arrow view
//
// RLArrowView.m
//
// Created by brian on 6/20/13.
// Copyright (c) 2013 RantLab. All rights reserved.
//
#import "RLArrowView.h"
@implementation RLArrowView
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@netgfx
netgfx / addObservers.swift
Last active March 4, 2025 07:16
Add observers to AVPlayer
// listening for current item change
self.audioQueueObserver = self.playerQueue?.observe(\.currentItem, options: [.new]) {
[weak self] (player, _) in
print("media item changed...")
}
// listening for current item status change
self.audioQueueStatusObserver = self.playerQueue?.currentItem?.observe(\.status, options: [.new, .old], changeHandler: {
(playerItem, change) in
if playerItem.status == .readyToPlay {
/*
* This script fetches all color styles from a Figma team/document.
*
* Dependencies:
*
* - node-fetch
*
* Due to a limitation in the Figma /styles endpoint, we need to use a
* document for actually using the colors in a color grid 🙄That's why
* we're both fetching from /styles and /files below.
@JasonCanCode
JasonCanCode / DynamicHeaderExample.swift
Last active April 18, 2021 18:45
Dynamic Table View Header Height
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
sizeTableViewHeaderToFit()
}
// MARK: - Dynamic Header Height
func sizeTableViewHeaderToFit() {
guard let headerView = tableView.tableHeaderView else {
@treastrain
treastrain / project.yml
Last active March 3, 2025 09:28
Japan NFC Reader の XcodeGen project.yml (ビルド 2020110801 時点)
attributes:
ORGANIZATIONNAME: treastrain / Tanaka Ryoga
name: JapanNFCReader
configs:
Debug: debug
Release: release
settings: