Skip to content

Instantly share code, notes, and snippets.

View jirevwe's full-sized avatar
😁

Raymond Tukpe jirevwe

😁
View GitHub Profile
@jirevwe
jirevwe / .bash_profile
Last active February 23, 2019 11:10 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
8. WEB DEVELOPMENT
# ---------------------------------------
alias apacheEdit='sudo edit /etc/httpd/httpd.conf' # apacheEdit: Edit httpd.conf
alias apacheRestart='sudo apachectl graceful' # apacheRestart: Restart Apache
alias editHosts='sudo edit /etc/hosts' # editHosts: Edit /etc/hosts file
alias herr='tail /var/log/httpd/error_log' # herr: Tails HTTP error logs
alias apacheLogs="less +F /var/log/apache2/error_log" # Apachelogs: Shows apache error logs
httpHeaders () { /usr/bin/curl -I -L $@ ; } # httpHeaders: Grabs headers from web page
@jirevwe
jirevwe / dropzone example.js
Last active April 7, 2017 11:38
DropzoneJS nodejs example code
//helper to get a file extension
String.prototype.getExtension = function() {
var basename = this.split(/[\\/]/).pop(), // extract file name from full path ...
// (supports `\\` and `/` separators)
pos = basename.lastIndexOf("."); // get last position of `.`
if (basename === "" || pos < 1) // if file name is empty or ...
return ""; // `.` not found (-1) or comes first (0)
return basename.slice(pos + 1); // extract extension ignoring `.`
@jirevwe
jirevwe / Player.cs
Last active April 25, 2017 16:46
Script for Barrel Roll... Explains how to use Unity3d's Quaternion.Slerp (Use a Coroutine instead)
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using UnityEngine;
public class Player : MonoBehaviour {
[SerializeField]
float flippedTime = 0f;
float startFlip = 0f;
@jirevwe
jirevwe / RotateOverTime.cs
Last active October 8, 2017 23:41
Unity C# snippet to rotate a transform to a new relative rotation over a number of seconds
// Rotate the object from it's current rotation to "newRotation" over "duration" seconds
void StartRotate(Vector3 newRotation, float duration = 0.5f)
{
if (SlerpRotation != null) // if the rotate coroutine is currently running, so let's stop it and begin rotating to the new rotation.
StopCoroutine(SlerpRotation);
SlerpRotation = Rotate(newRotation, duration);
StartCoroutine(SlerpRotation);
}
@jirevwe
jirevwe / HologramShader2D.cs
Created October 15, 2017 11:53
SpriteRe 2d Hologram Shader
Shader "Unlit/maskedSprite"
{
Properties
{
[Toggle]_ShowMask ("Preview mask", Float) = 0
[Space]
[Toggle]_UseAlpha ("Vertex Alpha > Threshold", Float) = 0
[Space]
_MaskThrs ("Mask Threshold", Range(0,1)) = .5
_MaskSoft ("Mask Width", Range (0.001, 3)) = 1
package ng.smartalumni.smartsocket;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import org.json.JSONException;
import org.json.JSONObject;
@jirevwe
jirevwe / CameraShake.cs
Last active February 25, 2018 22:28
A script to start a screen shake in Unity
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
public static CameraShake main;
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
@jirevwe
jirevwe / ScreenBase.cs
Created February 25, 2018 22:34
ScreenBase is a base class for Unity UI Panels. It handles transitions,
using UnityEngine;
using System.Collections;
using DG.Tweening;
using System;
[RequireComponent(typeof(CanvasGroup))]
public abstract class ScreenBase : MonoBehaviour
{
CanvasGroup canvasGroup;
@jirevwe
jirevwe / ScreenBase.cs
Created February 25, 2018 22:35
ScreenBase is a base class for Unity UI Panels. It handles transitions, adding tasks before and after the screen has shown and delays. It depends on DOTween
using UnityEngine;
using System.Collections;
using DG.Tweening;
using System;
[RequireComponent(typeof(CanvasGroup))]
public abstract class ScreenBase : MonoBehaviour
{
CanvasGroup canvasGroup;
@jirevwe
jirevwe / BottomBarNavigation.java
Created April 17, 2018 10:31
BottomBarNavigation code to retain fragment state
package com.ouida.app.ui.home;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;