Skip to content

Instantly share code, notes, and snippets.

@denvers
denvers / User.php
Last active August 29, 2015 13:59
Laravel upgrade to 4.1.26
<?php
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use \Eloquent;
class User extends Eloquent implements UserInterface, RemindableInterface
{
@JordanDalton
JordanDalton / Eloquent Model.php
Created August 20, 2014 18:19
Simple PHPStorm file template for creating a Eloquent-extended model inside of a namespace.
#if (${NAMESPACE})
<?php namespace ${NAMESPACE};
#else
<?php
#end
use Eloquent;
class ${NAME} extends Eloquent {
@Dykam
Dykam / README
Last active August 29, 2015 14:06
Event and Threading model proposal
A small non-complete example design and implementation of Observables/Tasks integrated into events.
It is inspired by a mix of classic Observables and .NET's Tasks/SynchronizationContext.
{
"version": {
"name": "13w41a",
"protocol": 0
},
"players": {
"max": 100,
"online": 5,
"sample":[
{"name":"Thinkofdeath", "id":""}
anonymous
anonymous / TimeOfDayManager
Created January 18, 2016 19:11
Control the sun, fog, ambient light, and sun rotation through curves and gradients.
using UnityEngine;
public class TimeOfDayManager : MonoBehaviour
{
public float secondsInFullDay = 120f;
[HideInInspector]
public float timeMultiplier = 1f;
@DreadBoy
DreadBoy / Graph.cs
Created May 15, 2016 08:03
Graph implementation in Unity
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
[Serializable]
public class Graph : ScriptableObject
{
[SerializeField]
@bugshake
bugshake / ReadableID
Created February 22, 2017 15:21
Translate a unique ID into something human readable/recognizable/discernable
public static class ReadableID
{
static readonly string[] syllables = new string[256];
public static void initOnce()
{
string[] consonants = new string[] { "b", "br", "c", "ch", "d", "f", "fr", "g", "h", "j", "k", "kn", "l", "m", "n", "p", "pr", "qu", "r", "s", "st", "sl", "sc", "t", "tr", "v", "w", "x", "z" };
string[] vowels = new string[] { "a", "e", "i", "o", "u", "y", "ae", "ee", "ea", "ai" };
for (int i = 0; i < syllables.Length; ++i)
{
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SliderValueText : MonoBehaviour
{
[SerializeField]
[Tooltip("The text shown will be formatted using this string. {0} is replaced with the actual value")]
private string formatText = "{0}°";
@bfulop
bfulop / tymeestimates
Last active February 24, 2018 13:17
Simplest way to export estimates from Tyme App. Copy paste into Script Editor and run
var tyme = Application('Tyme2')
var myproject = tyme.projects().filter(p => p.name() === 'MY PROJECT')[0]
getSpendTimes = t => t.taskrecords().reduce((acc,curr) => acc + curr.timedduration(),0)
getSubTimes = t => t.subtasks().reduce((acc,curr) => acc + getSpendTimes(curr),0)
getTotalSpendTimes = t => getSpendTimes(t) + getSubTimes(t)
@mattdesl
mattdesl / shadows.java
Created April 1, 2013 19:53
2D shadows in LibGDX
static Vector2 L = new Vector2();
static Vector2 N = new Vector2();
static Vector2 tmp = new Vector2();
static Vector2[] points = new Vector2[] {
new Vector2(), new Vector2(), new Vector2(), new Vector2()
};
static Vector2[] tmpBoundary = new Vector2[] {
new Vector2(), new Vector2()
};