Skip to content

Instantly share code, notes, and snippets.

View dezinezync's full-sized avatar
🏠
Working from home

Nikhil Nigade dezinezync

🏠
Working from home
View GitHub Profile
@dezinezync
dezinezync / 976px.fluid.grid.less
Created April 8, 2013 08:46
976px Fluid Grid
/*Grid*/
@gutter: 3.05514158%;
@col: 5.532786885%;
.grid1 { width: @col; }
.grid2 { width: @col*2 + @gutter; }
.grid3 { width: @col*3 + @gutter*2; }
.grid4 { width: @col*4 + @gutter*3; }
.grid5 { width: @col*5 + @gutter*4; }
.grid6 { width: @col*6 + @gutter*5; }
@dezinezync
dezinezync / clipp.html
Last active December 16, 2015 20:39
Clipp is a simple javascript function which helps you clipp text if it does not fit within it's element's bounding box.
<!DOCTYPE>
<html>
<head>
<title>Clipp - More text than an element can fit? Clipp it!</title>
<style>
body,html {
margin: 0;
}
@dezinezync
dezinezync / loadjquery.js
Last active December 16, 2015 22:29
Loading jQuery adaptively. Script originally from getflow.com Made minor fixes for compatibility.
window.jQuery || document.write('<script type="text/javascript" src="javascripts/libs/jquery-1.9.1.min.js"><\/script>')
@dezinezync
dezinezync / sortObject.js
Created July 7, 2013 09:32
Sorting an Object by it's keys alphabetically
var params = {
method: 'artist.getInfo',
api_key: '9bd9ee',
user_id: '3016',
format: 'json',
nojsoncallback: 1,
auth_token: '7215'
};
function sortObject(o) {
#eyebrow { display: none !important; }
body.with-eyebrow { padding-top: 49px !important; background: none !important; }
body.with-eyebrow #global-nav { top: 0 !important;}
body.with-eyebrow #subnav-refresh {top: -71px !important; }
body.with-eyebrow #view-holder {margin-top: -71px !important; }
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
@dezinezync
dezinezync / navwindow.js
Last active December 22, 2015 12:59
NavWindow example
var win =Ti.UI.iOS.createNavWindow({
width: Ti.UI.FILL,
height: TI.UI.FILL
});
win.open({
modal:true
})
- (BOOL)stringContainsEmoji:(NSString *)string {
__block BOOL returnValue = NO;
[string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
const unichar hs = [substring characterAtIndex:0];
// surrogate pair
if (0xd800 <= hs && hs <= 0xdbff) {
if (substring.length > 1) {
const unichar ls = [substring characterAtIndex:1];
// cheers to @stroughtonsmith for helping out with this one
UIColor *barColour = [UIColor colorWithRed:0.13f green:0.14f blue:0.15f alpha:1.00f];
UIView *colourView = [[UIView alloc] initWithFrame:CGRectMake(0.f, -20.f, 320.f, 64.f)];
colourView.opaque = NO;
colourView.alpha = .7f;
colourView.backgroundColor = barColour;
self.navigationBar.barTintColor = barColour;
## The Problem
Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)
## The temptingly easy but ultimately wrong solution:
Alter the port the script talks to from 8000 to 80:
}).listen(80);