Skip to content

Instantly share code, notes, and snippets.

View codeimpossible's full-sized avatar
🍕
P I Z Z A

Jared Barboza codeimpossible

🍕
P I Z Z A
View GitHub Profile
@codeimpossible
codeimpossible / AutohookAttribute.cs
Last active October 1, 2019 04:27 — forked from LotteMakesStuff/AutohookAttribute.cs
[Autohook] property drawer for unity - Add this [Autohook] attribute to a property to and the inspector will automagically hook up a valid reference for you if it can find a component attached to the same game object that matches the field you put it on. You can watch a demo of this in action here https://youtu.be/faVt09NGzws <3
// NOTE DONT put in an editor folder!
using UnityEngine;
public enum AutohookSearchArea {
Self,
Parent,
Children
}
public class AutohookAttribute : PropertyAttribute
public override void RenderContent(DataContext dataContext)
{
// Note: Given the framework/tech, I don't have full control over all of this. Maybe I should refactor?
var dataItem = GetDataItem(dataContext);
// If we're right-aligned, either set a new data item or don't do anything
if (IsRightAligned)
{
var rightAlignedDataItem = GetRightAlignedDataItem(dataContext, currentItemDetails, mediaList);
if (rightAlignedDataItem != null)
#
# An improvement on http://stackoverflow.com/a/9094206/284612
#
# Place this file in spec/support/signed_cookies.rb
#
module SignedCookies
def signed_cookie(name, opts={})
verifier = ActiveSupport::MessageVerifier.new(request.env["action_dispatch.secret_token".freeze])
if opts[:value]
@request.cookies[name] = verifier.generate(opts[:value])
@codeimpossible
codeimpossible / index.html
Last active December 23, 2015 06:19 — forked from anonymous/jsbin.IXALOP.css
new frag castle website design... rough draft
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<link href='http://fonts.googleapis.com/css?family=Iceland' rel='stylesheet' type='text/css'>
@codeimpossible
codeimpossible / Github OAuth ASP.Net MVC
Created September 20, 2012 15:19 — forked from abrudtkuhl/Github OAuth ASP.Net MVC
Github OAuth callback for ASP.Net MVC. Set yourapp.com/github/callback as the OAuth callback URL when you setup your application. If the users chooses to grant you permission, this controller/action get called to complete the transaction. See http://devel
public class GithubController : Controller
{
/// <summary>
/// Github OAuth Callback
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public JsonResult callback(string code)
{
var clientId = "[insert yours]";
@codeimpossible
codeimpossible / gist:3351974
Created August 14, 2012 19:25 — forked from jbubriski/gist:3207278
cache locking
private static readonly string _languagesKey = "languages";
public static Dictionary<string, string> GetLanguages()
{
return GetData(_languagesKey, () =>
{
// TODO: Get data from language service
var languages = new Dictionary<string, string>();
return languages;
@codeimpossible
codeimpossible / blackout.html
Created January 12, 2012 21:26 — forked from Miserlou/blackout.html
SOPA Blackout Script
<script type="text/javascript" src="https://github.com/Miserlou/Blaccupy/raw/master/blaccupy.js"></script>
@codeimpossible
codeimpossible / MassiveFluently.cs
Created January 6, 2012 18:39 — forked from jbubriski/MassiveFluently.cs
Massive Fluently rough draft
using System;
using System.Dynamic;
using System.Linq;
using Massive;
using Massive.Expressions;
public class Test
{
public void TestMethod( )
{