Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

var HTML_ENTITY_MAP = {
'&': '&'
, '<': '&lt;'
, '>': '&gt;'
, '"': '&quot;'
, "'": '&#x27;'
, '/': '&#x2F;'
};
// OSWASP Guidlines: &, <, >, ", ' plus forward slash.
@cweider
cweider / gist:2465637
Created April 22, 2012 17:52
CTUIImage+Extensions
//
// CTUIImage+Extensions.h
// MineSweeper
//
// Created by Chad Weider on 3/29/12.
// Copyright (c) 2012 Chad Weider. All rights reserved.
//
#import <UIKit/UIKit.h>
@cweider
cweider / gist:2460277
Created April 22, 2012 06:08
CTUIImage+Extensions
@implementation UIImage (CTUIImageExtensions)
+ (UIImage *)ct_imageWithPDFNamed:(NSString *)name size:(CGSize)size
{
CGFloat scale = 1;
CGColorSpaceRef colorspace = NULL;
CGContextRef layerContext = NULL;
void *layerBytes = NULL;
CGPDFDocumentRef iconDocument = NULL;
CGImageRef cg_image = NULL;
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
img[src="images/icon.png"] {
content: url("images/icon@2x.png");
}
img[src="images/store_small.png"] {
content: url("images/store_small@2x.png");
}
img[src="images/screen_fail.png"] {
content: url("images/screen_fail@2x.png");
}
@cweider
cweider / gist:1871440
Created February 20, 2012 21:09
Ace Templates
== iframeHTML
<!doctype html>
<html>
<head>
<%= INCLUDE_CSS %>
<%= INCLUDE_JS %>
<style type="text/css" title="dynamicsyntax"></style>
</head>
<body id="innerdocbody" class="syntax" spellcheck="false">
@cweider
cweider / yajsml
Created January 30, 2012 05:11
ACII YAJSML
o /|
_ _ __ _ _ _ _ / |
/ / / | / _/| / / / / /
|__/ /\_/\/ /\_\/ / |_/_/
___/_/ ___/_/ ________/___
/__/ /__/ \__/
@cweider
cweider / gist:1659874
Created January 23, 2012 01:36
The new style of `if` statement formatting for JS!?
if (x == y) {
something_equal();
}
else if (x < y) {
something_less();
}
else {
something_great();
}
@cweider
cweider / gist:1618182
Created January 16, 2012 00:20
Simplified Patch
commit e42f039941e83fa54b615a472f244d3f971c8330
Author: booo <borgers@mi.fu-berlin.de>
Date: Wed Dec 21 18:18:22 2011 +0100
fix issue #281; remove white spaces
diff --git a/node/utils/Minify.js b/node/utils/Minify.js
index fd1dd07..70ccc15 100644
--- a/node/utils/Minify.js
+++ b/node/utils/Minify.js
import random
import itertools
def bongo_sort(numbers):
for (smaller, larger) in itertools.izip(numbers, itertools.islice(numbers, 1, None)):
if larger < smaller:
random.shuffle(numbers)
return bongo_sort(numbers)
numbers = [4, 3, 2, 1]