Skip to content

Instantly share code, notes, and snippets.

View arunkarnann's full-sized avatar
🎯
Focusing

Arun Karnan arunkarnann

🎯
Focusing
View GitHub Profile
@arunkarnann
arunkarnann / gridsnap.cs
Last active June 1, 2017 07:49
Grid snapping for unity3d , Add Grid layout group And Add a Event trigger to the parent object and Add Begin Drag and End Drag Event listener to the respective function in the script
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class gridsnap : MonoBehaviour {
GridLayoutGroup grid;
RectTransform rect;
ScrollRect scrollRect;
Vector2 targetPos;
bool done = false;
float t = 0;
Shader "Custom/Gradient" {
Properties {
_direction("Direction",Range(0,1)) = 0
_color1 ("Color 1", Color) = (1,1,1,1)
_color2 ("Color 2", Color) = (0,0,1,1)
}
SubShader {
Pass{
CGPROGRAM
@arunkarnann
arunkarnann / flybirds.cs
Last active March 8, 2017 12:52
Birds flying in sine wave form Unity3d
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlyBirds : MonoBehaviour {
Vector3 firstPos;
[SerializeField]
Vector3 lastPos;
[SerializeField]
@arunkarnann
arunkarnann / clipboardmonitoringservice.java
Created November 11, 2016 06:13
clipboard monitoring service code
import android.app.Service;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ClipboardManager;
import android.content.ClipboardManager.OnPrimaryClipChangedListener;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
@arunkarnann
arunkarnann / chromecrash
Created November 11, 2016 06:09
android app log crash while clipborad even frired from chrome copy copy
11-11 11:32:53.662 16962-16962/com.renault.wordmonitoring I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@11cacff3 time:64935137
11-11 11:32:54.474 16962-16962/com.renault.wordmonitoring I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@910cac7 time:64935949
11-11 11:32:56.221 16962-16972/com.renault.wordmonitoring W/art: Suspending all threads took: 604.037ms
11-11 11:32:56.427 16962-16962/com.renault.wordmonitoring I/Choreographer: Skipped 75 frames! The application may be doing too much work on its main thread.
11-11 11:32:58.333 16962-16962/com.renault.wordmonitoring I/Timeline: Timeline: Activity_launch_request id:com.renault.wordmonitoring time:64939809
11-11 11:32:58.417 16962-16962/com.renault.wordmonitoring I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
11-11 11:32:58.594 16962-17047/com.renault.wordmonitoring D/OpenGLRenderer: endAllStagingAnimators on 0xb8c65888 (NavigationMenuView) with handle 0xb8dbebc8
11-11 11:32:58
@arunkarnann
arunkarnann / urlgrabber.py
Created November 9, 2016 05:39
python sript to grab .mp3 url from a html page/ web page
from bs4 import BeautifulSoup
import os
try:
import urllib.request as urllib2
except ImportError:
import urllib2
import sys
#Souce html from which the you want stuff to download
@arunkarnann
arunkarnann / CanvasToggler
Created October 27, 2016 14:15
A simple Unity3D Editor script to toggle canvas setactive. Useful when you want to design something in Editor and often messing up by selecting canvas instead of objects.
using UnityEngine;
using System.Collections;
using UnityEditor;
public class CanvasToggler : Editor {
public static GameObject[] canvases = GameObject.FindGameObjectsWithTag("Canvas") as GameObject[];
[MenuItem("Editor Tools/Toggle canvas")]
static void ActivateOrDeactivate(){
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class PostRenderer : MonoBehaviour
{
public Material _material;
void Awake()
{
// Description:
// Shows the definition of a word.
//
// Dependencies:
// Requires SoundManager2.
//
// Commands:
// define dictionary - gives the definition of the word "dictionary."
//
// Notes:
[RequireComponent(typeof(CharacterController))]
public class GZThirdPersonSimplified : MonoBehaviour {
[SerializeField] float m_TurnSpeed = 20;
[SerializeField] float m_TurnAmount;
Vector3 RotationVector;
[SerializeField] Vector3 moveDirection = Vector3.zero;
public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;