Skip to content

Instantly share code, notes, and snippets.

View igolden's full-sized avatar
🎯
Focusing

Ian Golden igolden

🎯
Focusing
View GitHub Profile
@igolden
igolden / setup_hosts.sh
Created September 17, 2018 15:30
Sets up dev server hostname for local machine
#!/usr/bin/env bash
FILE='/etc/hosts'
printf "Name your project (lowercase, no-spaces): \n"
read NAME
function setup_namespace {
sed -i .bak -e "s/project/$NAME/g" config/nginx.conf && rm config/*.bak
@igolden
igolden / run
Created November 4, 2017 04:10
Drop this in your bin folder if you're using rails and docker-compose
#!/usr/bin/env bash
##
# bin/run
# author: Ian Golden <ian@iangolden.com>
#
#
# Simple bash script to wrap the docker-compose run
# prefix for running commands in a dockerized rails
# setup. prefixes with docker-compose run bundle
@igolden
igolden / gist:39eab182d7b189ada1de0eaa89116b90
Created November 3, 2017 04:32
where my subsys is stored
%userprofile%\AppData\Local\Lxss
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
@igolden
igolden / drag.cs
Created October 18, 2017 06:52
Control drag on a rigid body (unity script)
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public Rigidbody rb;
void Start() {
rb = GetComponent<Rigidbody>();
}
void OpenParachute() {
rb.drag = 20;
@igolden
igolden / gist:1f38552ae2f4f4f81c6a77e4d8a3f2b3
Created October 18, 2017 05:45
Rotate object in Unity 3d
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public float smooth = 2.0F;
public float tiltAngle = 30.0F;
void Update() {
float tiltAroundZ = Input.GetAxis("Horizontal") * tiltAngle;
float tiltAroundX = Input.GetAxis("Vertical") * tiltAngle;
Quaternion target = Quaternion.Euler(tiltAroundX, 0, tiltAroundZ);
@igolden
igolden / gist:9565e53df1ac91c114f67a6e2b5ecce3
Created October 18, 2017 05:39
Main Camera toggle in Unity C# - toggles between two camera transforms
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraHandler : MonoBehaviour {
// Represents the main camera
GameObject mainCamera;
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Space))
@igolden
igolden / Timer.cs
Created October 17, 2017 00:12
Timer for unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Timer : MonoBehaviour {
public Text timerLabel;
private float time;
@igolden
igolden / MovementController.cs
Created October 16, 2017 23:24
Simple character movement in Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BoxController : MonoBehaviour {
public float speed = 10.0F;
public float rotationSpeed = 100.0F;
void Update()
{
@igolden
igolden / install_tmate.sh
Created September 7, 2017 23:23
Install tmate on ubuntu
#!/bin/bash
apt-get update && apt-get upgrade -y
apt-get install git-core build-essential \
pkg-config libtool libevent-dev \
libncurses-dev zlib1g-dev \
automake libssh-dev cmake \
ruby
# clone repo, change WORKDIR