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 / 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>
# Trim a set of permissions properties off of our model:
clone = @.omit _.filter @.keys, (key) -> !key.indexOf 'can_'
@codeimpossible
codeimpossible / autofart.js
Created May 9, 2013 17:08
give the gift of flatulence
// use this on any page with fartscroll -> http://theonion.github.io/fartscroll.js/
setInterval((function() {
var rangeUpper = 100;
$("body").fartscroll(100);
return function() {
var randomnumber = Math.floor( Math.random() * rangeUpper ),
mod = 1;
if( $(document).height() - $(window).scrollTop() - $(window).height() <= 0 ) {
mod = -1;
}
var hitBy = WeaponManager.CheckIfHit( this );
if( hitBy != null )
{
Hud.KillStreak = 0;
var damageAfterShields = Shields.AbsorbDamage( hitBy.Damage );
// huh, this is a bug. Looks like you won't take damage if you have less shields than weapon damage
if( damageAfterShields == hitBy.Damage )
{
(function($) {
$('.validation_error').each(function( index ) {
var $item = $(this);
var $control = $item.closest('tr').find('.EditingFormControlNestedControl').first();
$item.attr('id', control.id);
this.id = control.id;
});
})(jQuery);
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using FragEngine.Entities;
using FragEngine.IO;
using Microsoft.Xna.Framework;
namespace ThunderDome
@codeimpossible
codeimpossible / jquery.js
Created January 3, 2013 16:34
I love jquery
// function to mark a field invalid in one of our backbone viewws (uses backbone.validation)
function markFieldInvalid (view, attr, error) {
view.getFieldByName(attr)
.addClass('invalid')
.parents('.control-group:first')
.addClass('error')
.find('.help-inline, .help-block')
.text(error);
};
var DISQUSWIDGETS, disqus_domain, disqus_shortname;
typeof DISQUSWIDGETS == "undefined" && (DISQUSWIDGETS = function () {
var c = {}, m = document.getElementsByTagName("HEAD")[0] || document.body,
n = 0,
h = {}, k = {
identifier: 1,
url: 2,
slug: 3
};
c.domain = "disqus.com";
@codeimpossible
codeimpossible / peta_poco.cs
Created October 17, 2012 01:00
PetaPoco Example
[PetaPoco.TableName("People")]
[PetaPoco.PrimaryKey("Id")]
public class Person
{
public int Id { get; set; }
// .. some other fields
}
public ActionResult Create( Person person )
{
@codeimpossible
codeimpossible / JobsController.cs
Created October 9, 2012 00:42
JobsController from Proggr
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Proggr.Controllers.Filters;
using Proggr.Controllers.Responses;
namespace Proggr.Controllers
{