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
# Trim a set of permissions properties off of our model:
clone = @.omit _.filter @.keys, (key) -> !key.indexOf 'can_'
@codeimpossible
codeimpossible / ModuleMenu.html
Last active December 21, 2015 00:59
example interaction between a module and a common header layout in a backbone app...
<a href="#projects" class="dropdown-toggle">Projects<b class="caret"></b></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#projects/myprojects">My Teams' Projects</a></li>
<li class="divider"></li>
<li class="nav-header">Recent Projects</li>
</ul>
@codeimpossible
codeimpossible / gist:6231746
Created August 14, 2013 14:46
blog comment reply
var collection = [1,2,3,"4",5];
var current = -1;
for( var len = collection.length; ++current <= len; ) {
// do stuff
}
@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'>
/*!
* Bootstrap Responsive v2.3.2
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
#
# 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 / Actor.cs
Last active December 30, 2015 10:49
PlayerController from a unity game I am making.
using System;
using UnityEngine;
namespace FragCastle.GameObjects
{
public class Actor : MonoBehaviour
{
private const string HorizontalAxis = "Horizontal";
private Animator _animator;
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)
@codeimpossible
codeimpossible / extensions.cs
Created March 18, 2014 05:53
Some c# extension methods I wrote a really long time ago...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace CodeImpossible.Core
{
/// <summary>
/// Object extension methods
@codeimpossible
codeimpossible / WithTry.cs
Created March 18, 2014 05:57
A really odd DSL around try/catch in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
namespace WithTrySample
{
public class WithTryResult<T>
{