Skip to content

Instantly share code, notes, and snippets.

View aral's full-sized avatar

Aral Balkan aral

View GitHub Profile
Aral testing Gist
@aral
aral / gist:965632
Created May 10, 2011 23:48
Orientation change doesn't fire on iPad - workaround - jQueryMobile scrollView
/*$(document).live("orientationchange", function(event) {
ResizePageContentHeight($(".ui-page"));
});*/
// As per: http://code.google.com/p/jqtouch/issues/detail?id=370
$(window).bind('orientationchange', function(event) {
ResizePageContentHeight($(".ui-page"));
}).trigger('orientationchange');
@aral
aral / TextViewPinchToZoom
Created May 11, 2011 10:36
How to use add pinch-to-zoom to a TextView
// Create a pinch gesture recognizer instance.
self.pinchGestureRecognizer = [[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchGesture:)] autorelease];
// And add it to your text view.
[self.myTextView addGestureRecognizer:self.pinchGestureRecognizer];
// ...
- (void)pinchGesture:(UIPinchGestureRecognizer *)gestureRecognizer
{
@aral
aral / psextendscriptexample.js
Created June 4, 2011 21:04
Using ExtendScript to save out multiple resolution images from Photoshop (with unsharp mask)
/*
The original files are 960x319.
Image sizes to save:
* 800x266 - Retina for 480x320 resolution (400 logical pixel wide panel areas)
* 740x246 - Desktop and iPad
* 616x205 - Retina for 320x480 resolution (308 logical pixel wide panel areas)
* 400x133 - 480x320 resolution
* 308x102 - 320x480 resolution
@aral
aral / coffeetojson.sh
Created November 13, 2011 16:14
CoffeeScript to JSON script for OS X
coffee --print --compile $1.coffee | sed '1s/^.//' | sed 's/ });/}/' | sed "s/\([^ '\"].*[^ '\"]\):/\"\1\":/" > $1.json
@aral
aral / simple
Created June 5, 2012 07:31
A simple shiny CSS rounded button
/*
Apply to a <button>
Just playing, during Lea Verou's CSS3 workshop at NDC Oslo.
Released under the MIT License. http://en.wikipedia.org/wiki/MIT_License
*/
font-size:1em;
border-radius: 1em;
text-shadow: 1px 1px 0 hsla(0, 0%, 100%, 0.5);
@aral
aral / dabblet.css
Created June 5, 2012 08:58 — forked from LeaVerou/dabblet.css
Sticker
/* Sticker */
.sticker {
position: relative;
width: 3.5em;
height: 3.5em;
padding: 1em .5em 0;
margin: 100px;
background: slategray;
color: white;
@aral
aral / rem16px.styl
Created July 18, 2012 19:46
Work in progress… mixins for Stylus that handle 16px root em in a way that still gives you pixel parity
// Mixins
// Since some horrible browsers (e.g., on *spit* Android) don’t let you change the
// root em, I’m forced to use the browser default of 16px as the base. This mixin
// will help me keep sane by using units that correspond to pixel units.
line-height(h)
if unit(h) == "rem"
line-height: unit(h, 'px')
line-height: unit(h/16, 'rem')
@aral
aral / gist:6053501
Last active December 20, 2015 01:59
This is priceless, a spammer asking for his spam comment to be removed after being penalised by Google.
From: Pearl Scan <pearlscan@googlemail.com> To: Aral Balkan
Subject: Link Removal Request From Your Site
Hi Aral
Some time ago one of my colleagues will have commented on your blog on
the link provided below leaving behind a comment and a link back to
our website. We have had an unnatural links warning from Google and
need to try to have all links that aren't related to our own site
@aral
aral / gist:7831716
Created December 6, 2013 20:39
The masks (as exported from Sketch) fail in Firefox.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="201px" height="380px" viewBox="0 0 201 380" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>indie-phone</title>
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
<defs>
<path id="path-1" d="M-0.0291227715,378.94101 L199.872751,378.94101 L199.872751,22.9301112 C199.872751,22.9301112 202.32539,-0.0621634455 177.819211,-0.0621619269 C153.313032,-0.0621604084 18.8468331,-0.0621619269 18.8468331,-0.0621619269 C18.8468331,-0.0621619269 0.105729108,0.487780835 0.105728323,20.1962832 C0.105727868,39.9047856 -0.0291227715,378.94101 -0.0291227715,378.94101 Z"></path>
<mask id="mask-2" sketch:name="Path 1" fill="white">
<use xlink:href="#path-1"></use>
</mask>
</defs>