Skip to content

Instantly share code, notes, and snippets.

typeof NaN === 'number' // true
Infinity === 1/0 // true
0.1 + 0.2 === 0.3 // false
# Are you using the BASH shell?
echo $SHELL # /bin/bash
#
# Day-to-day shortcuts for the BASH shell
# ---------------------------------------
#
# up/down arrows => View your command history
#
# tab => Auto-complete file and directory names from ...
@mwbrooks
mwbrooks / PhoneGapDelegate.m
Created April 22, 2010 07:26
PhoneGap-iPhone Viewport Issue
//
// A quick and dirty fix to issue #51
//
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
CGRect windowFrame = [ [ UIScreen mainScreen ] bounds ];
CGRect webViewFrame = [ [ UIScreen mainScreen ] applicationFrame ];
webViewFrame.origin = windowFrame.origin;
self.window = [ [ [ UIWindow alloc ] initWithFrame:windowFrame ] autorelease ];
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@marijn
marijn / README.markdown
Last active September 13, 2024 19:00
List of countries in YAML, CSV and TXT format
/*
The MIT License
Copyright (c) 2010 Jesse MacFadyen, Nitobi Software
[email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
/**
* Lucida Grande doesn't have italics, but is preferable for its small size awesomeness.
* Lucida Sans has lovely italics.
* Let's use @font-face to combine them
*/
body {
font-family:'Lucida Improved','Lucida Grande','Lucida Sans','Lucida Sans Unicode',Verdana,sans-serif;
}
@font-face {
font-family:'Lucida Improved';
@mwbrooks
mwbrooks / index.html
Created October 3, 2010 21:23
PhoneGap-Console
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
<title>PhoneGap Console</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">
@mwbrooks
mwbrooks / notification.confirm.md
Created October 22, 2010 16:48
Markdown code block within list item

iPhone Quirks

  • iPhone does not block while the confirm dialog is displayed.
  • Returns a delegate object from navigator.notification.confirm()
  • Calls delegate.onAlertDismissed(index, label) when confirm is dismissed
    • index is the 0 based index value of the button pressed
    • label is the text label of the button pressed

function showConfirm() {

@mwbrooks
mwbrooks / style.css
Created February 22, 2011 19:34
Remove input field shadow from iOS-Webkit
input[type="text"] {
-webkit-appearance:none; /* Remove default shadow */
border:1px solid black; /* Possibly apply a custom border */
}