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
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 / 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>
{

Keybase proof

I hereby claim:

  • I am codeimpossible on github.
  • I am codeimpossible (https://keybase.io/codeimpossible) on keybase.
  • I have a public key whose fingerprint is AEB9 81B3 8416 24B7 0CCB 27AA 091E 348F D8F9 61E9

To claim this, I am signing this object:

@codeimpossible
codeimpossible / tilelayer.cs
Created May 5, 2014 19:16
ERMAH GERD WHY NO GIZMOS?!?!?!
[ExecuteInEditMode]
public class TileLayer : MonoBehaviour
{
public Vector2 LayerSize;
public Vector2 CellSize;
public Color GridColor;
public bool DrawGridLines;
public bool DrawPaintbrushGuide;
@codeimpossible
codeimpossible / directions.md
Last active August 29, 2015 14:01
compiling ragel with js support on mac osx

Prerequisites

  • Node.js (0.10.9 or higher with npm)
  • Make sure you have gcc/g++ 4.6 (4.7 is too strict to build ragel-js)
  • Make sure you have autoconf and automake (brew install automake)
  • Make sure you have the official ragel (brew install ragel)

Clone the gcc patched version of ragel-js

$ git clone https://github.com/codeimpossible/ragel-js

# vim:ft=zsh ts=2 sw=2 sts=2
#
# Based on 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://gist.github.com/1595572).
#
@codeimpossible
codeimpossible / JamesBond.cs
Created October 28, 2014 02:52
JamesBond - a quick and dirty lesson in reflection, invocation and generally mucking about with an objects private vars
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Dynamic;
using System.Reflection;
using System.Linq.Expressions;
namespace MISix {
public class ReflectedResult<T> {
@codeimpossible
codeimpossible / pod-pub.ps1
Created February 7, 2015 13:18
Script to automate our podcast publishing
Param (
[Parameter(Mandatory=$True)]
[string]$url
)
# this assumes you have youtube-dl installed
# choco install youtube-dl
# this also assumes you have ffmpeg installed
# choco install ffmpeg
@codeimpossible
codeimpossible / blog-post-importer.es6
Created June 29, 2015 17:09
Abstract Factory, with self-registration!
let subclasses = {};
export default class BlogPostImporter {
constructor(body) {
for(var p in body) {
if(body.hasOwnProperty(p)) {
this[p] = body[p];
}
}
}