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 / ie_hacks.css
Created December 6, 2011 21:15
IE Css Hackery
li.search span.selection {
height: /*\**/19px!important; /*ie9*/
_height: 19px!important; /*ie6*/
}
@media \0screen {
li.search span.selection {
height: 20px!important; /*ie8*/
}
@codeimpossible
codeimpossible / gist:1447083
Created December 8, 2011 14:08
Brute force way to eliminate nasty alert() statements
// brute force
// this actually turns out to be better than alert()
// as it will stop stupid "[Object object]" alerts
// and instead log the actual object to the console
// the console && console.log check is to make sure
// this code doesn't fail in IE which does not create
// the console obj unless the user has dev tools open.
window.alert = function(m) {
if(console && console.log) {
@codeimpossible
codeimpossible / gist:1537211
Created December 30, 2011 01:47
get reference to window with obfuscated javascript
$=((([])[(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]]));$()["eval"]("alert(1)")
@codeimpossible
codeimpossible / MassiveFluently.cs
Created January 6, 2012 18:10
Massive Fluently rough draft
using System;
using System.Dynamic;
using Massive;
namespace MassiveFluently.Expressions {
public class All {}
public class First {}
public class Last {}
}
namespace MassiveFluently {
@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( )
{
@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 / steveaustin.cs
Created February 14, 2012 03:06
SteveAustin!!!
private dynamic SteveAustin( string[] props, object[] args, object thing ) {
var sixmill_man = new ExpandoObject();
var steve = sixmill_man as IDictionary<string, object>;
for( int i = 0; i < props.Length; i++ ) {
steve.Add( props[ i ], args[ i ] );
}
if( thing != null )
foreach( var pair in thing.ToDictionary() )
if( !steve.ContainsKey( pair.Key ) )
steve.Add( pair.Key, pair.Value );
<script type="text/javascript">
/*
html2canvas v0.33 <http://html2canvas.hertzen.com>
Copyright (c) 2011 Niklas von Hertzen. All rights reserved.
http://www.twitter.com/niklasvh
Released under MIT License
*/
(function(j,L,n){function C(a){l.logging&&j.console&&j.console.log&&j.console.log(a)}function S(a,b){var h=[];return{storage:h,width:a,height:b,fillRect:function(){h.push({type:"function",name:"fillRect",arguments:arguments})},drawImage:function(){h.push({type:"function",name:"drawImage",arguments:arguments})},fillText:function(){h.push({type:"function",name:"fillText",arguments:arguments})},setVariable:function(a,b){h.push({type:"variable",name:a,arguments:b})}}}var l={logging:!1};l.log=C;l.Util=
{};l.Util.backgroundImage=function(a){if(/data:image\/.*;base64,/i.test(a)||/^(-webkit|-moz|linear-gradient|-o-)/.test(a))return a;a.toLowerCase().substr(0,5)==='url("'?(a=a.substr(5),a=a.substr(0,a.length-2)):(a=a.substr(4),a=a.substr(0,a.length-1));return a};l.Util.Bounds=function(a){var b={};if(a.getBo
@codeimpossible
codeimpossible / gist:2921095
Created June 13, 2012 00:52
get number of closed questions from stackoverflow for a certain tag
function showStats(tag_name) {
var script = document.createElement("scr" + "ipt");
script.src = "https://api.stackexchange.com/2.0/questions?fromdate=1336780800&todate=1339459200&order=desc&sort=activity&tagged=" + tag_name + "&site=stackoverflow&callback=renderStats";
console.log(script);
$('body').append( script );
}
window.renderStats=function( json ) {
var num_closed = 0;
for(var i = -1, l = json.items.length; ++i < l; ) {
@codeimpossible
codeimpossible / pushstate.js
Created July 20, 2012 19:45
Pushstate example
$('a').click(function(e) {
e.preventDefault();
var url = this.href;
$.get(url, function(html) {
$('.newpage').html(html).animate({ left: "-= 1000px" }, function() {
window.history.pushState({}, "New Page Title", url );
});
});
return false;
});