Skip to content

Instantly share code, notes, and snippets.

View drawcode's full-sized avatar
😎
Shipping product

Ryan Christensen drawcode

😎
Shipping product
View GitHub Profile
@drawcode
drawcode / find-in-json-by-dot-path.js
Created May 9, 2015 06:28
Find in json by pathname
Object.byString = function(o, s) {
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
s = s.replace(/^\./, ''); // strip a leading dot
var a = s.split('.');
for (var i = 0, n = a.length; i < n; ++i) {
var k = a[i];
if (k in o) {
o = o[k];
} else {
return;
@drawcode
drawcode / gist:fb6050c510c5d3c7a193
Created May 9, 2015 06:25
Express 4 json spaces
app.set('json spaces', 4);
@drawcode
drawcode / unitycacheserver.command
Created March 15, 2015 06:11
Unity Cache Server startup OSX - limit to 10GB
./RunOSX.command --path ./cachedata/ --size 10000000000
@drawcode
drawcode / Flick.cs
Created February 5, 2015 02:32
Flick.cs
using UnityEngine;
using System.Collections;
//demand an adio source be placed on this component for use with the audio clip
[RequireComponent(typeof(AudioSource))]
public class FlickThrowTouch : MonoBehaviour
{
public Vector2 touchStart;
public Vector2 touchEnd;
public int flickTime = 5;
void Start () {
float min = float.MaxValue;
float max = float.MinValue;
const float ratio = 1.5f;
for (int x = 0; x < 100; x++)
{
for (int y = 0; y < 100; y++)
@drawcode
drawcode / LICENSE
Last active August 29, 2015 14:10 — forked from jdp/LICENSE
Copyright (C) 2012 Justin Poliey <justin.d.poliey@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
@drawcode
drawcode / gulp.sh
Created November 18, 2014 01:07
Node gulp setup...
sudo npm install -g gulp
gulp -v
npm install --save-dev gulp
npm install gulp-jshint gulp-sass gulp-concat gulp-uglify gulp-rename --save-dev
@drawcode
drawcode / floaterheightforce.css
Created November 4, 2014 04:57
force container to have height even with float elements
.c{
...
overflow: hidden;
}
This will force the container to respect the height of all elements within it, regardless of floating elements.
http://jsfiddle.net/gtdfY/3/
UPDATE
Recently, I was working on a project that required this trick, but needed to allow overflow to show, so instead, you can use a pseudo-element to clear your floats, effectively achieving the same effect while allowing overflow on all elements.
I just move the camera holder object with this
//CAMERA MOVEMENT CONTROLS
float MoveVertical = Input.GetAxis("Vertical") * VerticalCameraSpeed * Time.deltaTime;
float MoveHorizontal = Input.GetAxis("Horizontal") * HorizontalCameraSpeed * Time.deltaTime;
CameraHolder.transform.Translate (Vector3.forward * MoveVertical);
CameraHolder.transform.Translate (Vector3.right * MoveHorizontal);
float Rotation = Input.GetAxis("Rotation");
if (Input.GetAxis ("Rotation") < 0 || Input.GetAxis ("Rotation") > 0)
{
CameraHolder.transform.Rotate(Vector3.up, Rotation * CameraRotateSpeed * Time.deltaTime,Space.World);
<div>
<h1>Tweetbox</h1>
<form id="my-tweetbox">
<p><textarea name="tweet">Write your tweet...</textarea></p>
<p><input type="submit" name="submit" value="Tweet!" /></p>
</form>
</div>
<div>
<h1>County Tweetbox</h1>