Skip to content

Instantly share code, notes, and snippets.

@ftvs
ftvs / tk2dTweenAlpha
Created March 7, 2013 13:12
Alpha tween for 2D toolkit sprites. Inherits NGUI's UITweener.
// Alpha tween for 2D toolkit sprites. Uses same method signatures as NGUI's
// TweenAlpha.
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(tk2dBaseSprite))]
public class tk2dTweenAlpha : UITweener
{
public float from = 0f;
// Shows the share sheet with the given items with a list of excludedActivityTypes. See Apple\'s docs for more information on excludedActivityTypes.
public static void shareItems( string[] items, string[] excludedActivityTypes )
// Shows the Facebook composer with optional image path and link
public static void showFacebookComposer( string message, string imagePath, string link )
// Only applies to iOS level Twitter account (Settings -> Twitter)! Shows the tweet composer with the status message and optional image and link.
public static void showTweetComposer( string status, string pathToImage, string link )
/*
PreviewLabs.PlayerPrefs
Public Domain
To the extent possible under law, PreviewLabs has waived all copyright and related or neighboring rights to this document. This work is published from: Belgium.
http://www.previewlabs.com
*/
using UnityEngine;
using System.Collections;
using System.Security.Cryptography;
using System.Text;
public class EncryptedPlayerPrefs {
// Encrypted PlayerPrefs
// Written by Sven Magnus
// MD5 code by Matthew Wegner (from [url]http://www.unifycommunity.com/wiki/index.php?title=MD5[/url])
@ftvs
ftvs / CameraShake.cs
Last active May 8, 2024 20:34
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.
using UnityEngine;
using System.Collections;
using Holoville.HOTween;
public class GUIUtils : MonoBehaviour
{
public UISprite transition;
void Awake()
{
@ftvs
ftvs / README.md
Last active December 14, 2020 04:16
Project README.md template.

Project Information

(this section can omit information that is already on the project page, in which case a link will suffice)

  • OS:
  • Devices:
  • Orientation:
  • Framework: (eg iOS UIKit framework, cocos2d-x, Unity)
  • Multiple resolution policy (how the app handles multiple screen resolutions, sizes and aspect ratios)
  • Branches of the repository and which to use for development, release etc
@ftvs
ftvs / main.py
Created November 16, 2014 13:08
Project Euler
import os, sys
if __name__ == '__main__':
print("Python Version: " + sys.version)
print("Python Executable: " + sys.executable)
print("Env var TEST_NAME: " + os.getenv('TEST_NAME', None))
def primes(maxprime):
primes = [2]
@ftvs
ftvs / iOS_time_zones.txt
Created July 30, 2015 09:03
List of time zones on iOS. Displays 30 July 2015 12AM GMT+0 in various time zones.
July 30, 2015 at 12:00:00 AM GMT Africa/Abidjan
July 30, 2015 at 12:00:00 AM GMT Africa/Accra
July 30, 2015 at 3:00:00 AM GMT+3 Africa/Addis_Ababa
July 30, 2015 at 1:00:00 AM GMT+1 Africa/Algiers
July 30, 2015 at 3:00:00 AM GMT+3 Africa/Asmara
July 30, 2015 at 12:00:00 AM GMT Africa/Bamako
July 30, 2015 at 1:00:00 AM GMT+1 Africa/Bangui
July 30, 2015 at 12:00:00 AM GMT Africa/Banjul
July 30, 2015 at 12:00:00 AM GMT Africa/Bissau
July 30, 2015 at 2:00:00 AM GMT+2 Africa/Blantyre
@ftvs
ftvs / PhonecallReceiver.java
Last active October 11, 2023 10:05
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {