Skip to content

Instantly share code, notes, and snippets.

// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@darktable
darktable / ProjectAssetPostprocessor.cs
Created April 20, 2012 03:37 — forked from hoesing/ProjectAssetPostprocessor.cs
Unity asset pre/postprocessor for applying asset defaults by path.
// Drop this script in the Editor directory in your project (creating the Editor directory if it's not there yet)
// Then re-import the assets in the directories covered by this script (right click and reimport)
//
// I would replace my path checking with the path checking from this gist:
// https://gist.github.com/1842177
//
// The texture settings for icons might want to use some of his settings combined with mine as well
using UnityEngine;
@pixelrevision
pixelrevision / PixelPerfectCam.cs
Last active January 26, 2024 05:23
Script for unity to create a pixel locked orthogonal camera
using UnityEngine;
/**
* A camera to help with Orthagonal mode when you need it to lock to pixels. Desiged to be used on android and retina devices.
*/
public class PixelPerfectCam : MonoBehaviour {
/**
* The target size of the view port.
*/
public Vector2 targetViewportSizeInPixels = new Vector2(480.0f, 320.0f);
/**
@SidneyAllen
SidneyAllen / StackMob.cs
Created August 30, 2012 19:37 — forked from nixbb/StackMob.cs
StackMob OAuth 2.0 Unity 3D Example
using UnityEngine;
using System.Collections;
using System.Security.Cryptography;
using System;
using System.Text;
public class StackMob : MonoBehaviour
{
public const string acceptHeader = "application/vnd.stackmob+json; version=0"; // 0 = development, 1 = production
public const string apiKey = "e78a2646-d479-47b1-9ae5-65732c5eabdc"; // nixApp
@mikamikuh
mikamikuh / csharp.py
Created September 11, 2012 16:32
Unity C#'s error checker for SublimeLinter
# -*- coding: utf-8 -*-
# java.py - sublimelint package for checking java files
import sublime
import subprocess
import os
import os.path
import re
from base_linter import BaseLinter, INPUT_METHOD_FILE
@kyleweiner
kyleweiner / Unity 2DController
Created November 9, 2012 15:07
Unity: A boilerplate 2D controller for use with Unity 3D
#pragma strict
/***********************************************************************
* Notes
***********************************************************************/
/*
* This is a boilerplate controller for a 2D or 2.5D platform game.
* To that end, this controller allows for movement along the X and Y
* axes only. There is built-in support for jumping, double jumping,
@stramit
stramit / CoroutineTween.cs
Last active August 16, 2016 23:34
CoroutineTween.cs
/*
* This code is provided as is without warranty, guarantee of function,
* or provided support
*/
using System.Collections;
using UnityEngine.Events;
namespace UnityEngine.UI.CoroutineTween
{
@staltz
staltz / introrx.md
Last active June 15, 2024 12:24
The introduction to Reactive Programming you've been missing
@vlucas
vlucas / pre-push.sh
Created July 22, 2014 16:12
Prevent Pushes Directly to Master
#!/bin/bash
# @link https://gist.github.com/mattscilipoti/8424018
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
@stramit
stramit / PointerInputModule.cs
Last active October 18, 2018 05:25
Beta 19
using System.Collections.Generic;
using System.Text;
namespace UnityEngine.EventSystems
{
public abstract class PointerInputModule : BaseInputModule
{
public const int kMouseId = -1;
public const int kFakeTouchesId = -2;