Skip to content

Instantly share code, notes, and snippets.

Chad Weider cweider

Block or report user

Report or block cweider

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View HTMLString.js
var HTML_ENTITY_MAP = {
'&': '&'
, '<': '&lt;'
, '>': '&gt;'
, '"': '&quot;'
, "'": '&#x27;'
, '/': '&#x2F;'
};
// OSWASP Guidlines: &, <, >, ", ' plus forward slash.
@cweider
cweider / gist:2465637
Created Apr 22, 2012
CTUIImage+Extensions
View gist:2465637
//
// 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 Apr 22, 2012
CTUIImage+Extensions
View gist:2460277
@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;
View gist:2394800
@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");
}
View gist:1871440
== 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 Jan 30, 2012
ACII YAJSML
View yajsml
o /|
_ _ __ _ _ _ _ / |
/ / / | / _/| / / / / /
|__/ /\_/\/ /\_\/ / |_/_/
___/_/ ___/_/ ________/___
/__/ /__/ \__/
@cweider
cweider / gist:1659874
Created Jan 23, 2012
The new style of `if` statement formatting for JS!?
View gist:1659874
if (x == y) {
something_equal();
}
else if (x < y) {
something_less();
}
else {
something_great();
}
@cweider
cweider / gist:1618182
Created Jan 16, 2012
Simplified Patch
View gist:1618182
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
View gist:262812
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]
You can’t perform that action at this time.