Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-with-addons-0.13.1.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="container"></div>

Keybase proof

I hereby claim:

  • I am cgack on github.
  • I am cgack (https://keybase.io/cgack) on keybase.
  • I have a public key whose fingerprint is 7B59 A885 709F C977 9621 0DEC EB66 D4D1 3E4B 888C

To claim this, I am signing this object:

@cgack
cgack / jsbin.acIRUBo.css
Created May 8, 2014 14:36
change css for navbar
.cg-navbar {
max-width: 100%
}
.cg-navbar__bar {
padding: 0;
display: table; table-layout:fixed; width: 100%;,
}
.cg-navbar__baritem{
@cgack
cgack / gist:4530524
Created January 14, 2013 14:44
onClick
/* turn all target = _blanks into whitelisted urls */
$(document).on("click", function (event) {
if (event.target.target === "_blank" && event.target.href.indexOf("#openExternal=true") === -1) {
event.target.href = event.target.href + "#openExternal=true";
}
});
@cgack
cgack / gist:4530512
Created January 14, 2013 14:42
fragment
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
if ( ([url fragment] != NULL) && ([[url fragment] rangeOfString:@"openExternal=true"].location != NSNotFound) )
{
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
}
return YES;
@cgack
cgack / gist:4530483
Created January 14, 2013 14:37
hasSuffix in PhoneGap
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if ((navigationType == UIWebViewNavigationTypeLinkClicked) && ([[url absoluteString] hasSuffix:@"?openExternal=1"] ))
{
[[UIApplication sharedApplication] openURL:url];
return NO;
}
return YES;
}
@cgack
cgack / gist:4530044
Last active December 11, 2015 02:19
Whitelist a URL in PhoneGap
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if ((navigationType == UIWebViewNavigationTypeLinkClicked) &&
([[[request URL] absoluteString] hasPrefix:@"https://www.google.com"]))
{
[[UIApplication sharedApplication] openURL:request.URL];
return NO;
}
return YES;
}
var Greeter = (function () {
function Greeter(message) {
this.greeting = message;
}
Greeter.prototype.greet = function () {
return "Hello, " + this.greeting;
};
return Greeter;
})();
var greeter = new Greeter("world");
class Greeter {
greeting: string;
constructor (message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
@cgack
cgack / libpx_snippet.js
Created September 30, 2012 15:54
libpx snippet
if (me.game.STATE.weaponState === "magic_torrentacle") {
if (this.direction === "west") {
magic = new MagicEntity(this.pos.x - 100, this.pos.y + 30 , { image: "magic_torrentacle", spriteheight: 128, spritewidth: 128});
magic.flipX(true);
me.game.add(magic, this.z);
me.game.sort();
} else if (this.direction === "east") {
magic = new MagicEntity(this.pos.x + 42, this.pos.y + 30, { image: "magic_torrentacle", spriteheight: 128, spritewidth: 128 });
me.game.add(magic, this.z);
me.game.sort();