Skip to content

Instantly share code, notes, and snippets.

View robinnorth's full-sized avatar
:octocat:

Robin North robinnorth

:octocat:
View GitHub Profile
@Naphier
Naphier / UGuiTextToTextMeshPro.cs
Created January 4, 2017 15:23
Unity3D Editor Tool to convert Unity GUI Text objects to Text Mesh Pro Text Objects
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using TMPro;
using TMPro.EditorUtilities;
public class UGuiTextToTextMeshPro : Editor
{
[MenuItem("GameObject/UI/Convert To Text Mesh Pro", false, 4000)]
static void DoIt()
@jasonclark
jasonclark / social-media-share-markup
Last active January 27, 2017 15:43
Minimum viable social metadata markup - opengraph and twitter; Based on: https://dev.twitter.com/cards/getting-started#opengraph
<meta property="og:title" content="EmbedThis (Oembed)"/>
<meta property="og:description" content="Utility app that checks for an Oembed endpoint & returns HTML embed code."/>
<meta property="og:image" content="http://www.lib.montana.edu/~jason/files/oembed-this/meta/img/share-code-small.png"/>
<meta property="og:url" content="http://www.lib.montana.edu/~jason/files/oembed-this/index.php"/>
<meta property="og:type" content="website"/>
<meta name="twitter:creator" property="og:site_name" content="@jaclark"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="http://www.jasonclark.info"/>
@niyazpk
niyazpk / pQuery.js
Created October 25, 2014 14:03
Add or update query string parameter
// Add / Update a key-value pair in the URL query parameters
function updateUrlParameter(uri, key, value) {
// remove the hash part before operating on the uri
var i = uri.indexOf('#');
var hash = i === -1 ? '' : uri.substr(i);
uri = i === -1 ? uri : uri.substr(0, i);
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
@passsy
passsy / material text sizes.md
Last active May 25, 2023 04:24
Material font sizes
@andrewlkho
andrewlkho / gist:10739376
Last active December 24, 2018 16:57
Clean URLs on jekyll/Apache

This was originally posted on 2011-07-11 to http://andrewho.co.uk/weblog/clean-urls-on-jekyll-apache

I use a static site generator, specifically [jekyll][], to transform some templates into a set of static *.html files. However, I like to keep the URLs looking clean, and not display the .html extension both because I think it looks better and also so that the URLs purely reflect the content and not the underlying files or CMS used to serve that content. In short, whilst the file being served might be $DOCUMENT_ROOT/weblog/title.html, the canonical URL for that resource should be /weblog/title. Here's how I do that in .htaccess.

@nicoverbruggen
nicoverbruggen / CDVCommandQueue.m
Last active August 29, 2015 13:57
Cordova iOS 7.0/7.1 optimizations. Also fixes for 7.1 arm64 crashes in plugins in CordovaLib < 3.5. Also includes fix for no splash screen on iPhone with 3.5" screen.
// Fix for BAD_ACCESS on arm64 devices
// Per this diff: https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;a=blobdiff;f=CordovaLib/Classes/CDVCommandQueue.m;h=1eddfe37ee699289701cd4caaf68486607010501;hp=902dfa0227f1358296d2218fa0e6d5cc2a882ea6;hb=82ce4f2;hpb=7da5f2df3417de68a1b540bc00c11a95ce3dc7d6
// Should be fixed in CordovaLib 3.5
SEL normalSelector = NSSelectorFromString(methodName);
if ([obj respondsToSelector:normalSelector]) {
// [obj performSelector:normalSelector withObject:command];
((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command); // replace the old line with this one
} else {
// There's no method to call, so throw an error.
@alienresident
alienresident / video-fix-videos-for-pseudo-streaming.md
Last active April 20, 2024 05:02
How to: Fix pseudo-streaming videos by moving Moov Atom
How to:

Fix pseudo-streaming videos by moving Moov Atom

Relies on some *nix CLI utilities: mediainfo; and qt-faststart (part of ffmpeg). I used homebrew to install them on OS X.

What is pseudo-streaming?

Pseudo streaming is simply a video that can start playing before it's fully dowmloaded. The videos are not streaming but rather progressively downloaded. What's important is that the file metadata (the Moov Atom) is at the start of the file rather than at the end. Usually this is an option set when encoding the file (called quick start or web start). If the files have not been encoded this way you can either re-encode or use a utility to move the Moov Atom. Re-encoding takes much longer than using a utility to move the Moov Atom so here's how to do it.

Steps

First check with mediainfo to see if video 'is streamable':

#!/bin/bash -x
CALLERS_UID="$1"
REFCOUNT_PATH="$2"
DCALL_PATH="$3"
if [ $UID -ne 0 ]; then
# Test that the script is run as root.
echo "Script must run as root"
exit 1
@Hamcha
Hamcha / SmoothFollow.cs
Created July 28, 2013 00:45
Stupid Unity scripts : "Smooth Follow" from Standard Assets
// Smooth Follow from Standard Assets
// Converted to C# because I fucking hate UnityScript and it's inexistant C# interoperability
// If you have C# code and you want to edit SmoothFollow's vars ingame, use this instead.
using UnityEngine;
using System.Collections;
public class SmoothFollow : MonoBehaviour {
// The target we are following
public Transform target;
@ftvs
ftvs / CameraShake.cs
Last active April 17, 2024 23:08
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.