Skip to content

Instantly share code, notes, and snippets.

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

Tri Vuong trivektor

🏠
Working from home
View GitHub Profile
@trivektor
trivektor / README
Created September 26, 2013 22:35 — forked from joelambert/README
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
http://www.kylejlarson.com/blog/2011/fixed-elements-and-scrolling-divs-in-ios-5/<html>
<head>
<meta name="viewport" content="initial-scale = 1.0, user-scalable = no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<style>
body {margin: 0; padding: 0;}
#width {width: 100%;}
#content {position: absolute; top: 50px; left: 0; right: 0; bottom: 50px; overflow: scroll; -webkit-overflow-scrolling: touch;}
p {margin-bottom: 20px;}
#header {background: #000; color: #fff; height: 50px; position: fixed; top: 0; width: 100%;}
@trivektor
trivektor / gist:5931660
Created July 5, 2013 04:36
Font Awesome icons list
icon-glass
icon-music
icon-search
icon-envelope-alt
icon-heart
icon-star
icon-star-empty
icon-user
icon-film
icon-th-large
function myFunction (a, blabla, c, somethingElse, e, f) {
var obj = [];
//'(a, b, c, d, e, f)'
var tmp = arguments.callee.toString().match(/\(.*?\)/g)[0];
//["a", "b", "c", "d", "e", "f"]
var argumentNames = tmp.replace(/[()\s]/g,'').split(',');
[].splice.call(arguments,0).forEach(function(arg,i) {
obj.push({
// question is how to get variable name here?
@trivektor
trivektor / gist:5638160
Created May 23, 2013 18:10
Useful Unix commands
stat -c %a /etc/passwd
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@trivektor
trivektor / gist:4525664
Created January 13, 2013 18:51
Removing shine effect from the buttons in a UINavigationBar
// http://pastebin.com/raw.php?i=Xdf49BgK
@interface UIBarButtonItem (UIBarButtonItem_customBackground)
+ (id) customBarButtonWithTitle:(NSString *)title target:(id)target selector:(SEL)selector;
+ (id) customBackButtonWithTitle:(NSString *)title target:(id)target selector:(SEL)selector;
@end
@implementation UIBarButtonItem (UIBarButtonItem_customBackground)
@trivektor
trivektor / gist:4496809
Created January 9, 2013 20:49
Inner radial gradient
background-image: -webkit-gradient(radial, 50% 50%, 1, 50% 50%, 283, color-stop(0, rgba(112, 66, 20, 0.2)), color-stop(1, rgba(112, 66, 20, 0.4)));
background-image: -webkit-radial-gradient(rgba(112, 66, 20, 0.2), rgba(112, 66, 20, 0.4));
background-image: -moz-radial-gradient(rgba(112, 66, 20, 0.2), rgba(112, 66, 20, 0.4));
background-image: radial-gradient(rgba(112, 66, 20, 0.2), rgba(112, 66, 20, 0.4));
-webkit-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
-moz-box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
@trivektor
trivektor / gist:3718745
Created September 13, 2012 23:54
YP logo css3
gradient_background(start_color, stop_color)
background linear-gradient(top, start_color, stop_color); /* Standard (W3C) */
background -moz-linear-gradient(center top, start_color, stop_color); /* FF */
background -webkit-gradient(linear, left top, left bottom, from(start_color), to(stop_color)); /* Chrome, Safari */
background -o-linear-gradient(top, start_color, stop_color); /* Opera */
body
background url(/images/darkdenim3.png) repeat
font-family Arial
font-size 12px