Skip to content

Instantly share code, notes, and snippets.

View jmwhittaker's full-sized avatar

James Whittaker jmwhittaker

View GitHub Profile
/*
This shows a bug where trying to programatically close a window in a navigationGroup fails
*/
//Here's the first window...
var first = Ti.UI.createWindow({
backgroundColor:"#fff",
title:"My App"
});
/*
Trying to get a tabGroup working inside a Modal window. My Main app already has a tabGroup, the modal appear over the top.
I get the tabGroup to appear, but trying to open new windows just silently fails.
*/
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
@jmwhittaker
jmwhittaker / BodyID switch quick example
Created January 6, 2011 17:49
A very quick example of how changing an ID on the body can switch layouts
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Body tag switching</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("header a").bind("click", function(event){
@jmwhittaker
jmwhittaker / gist:847243
Created February 28, 2011 12:16
Border-image CSS3 Mixin for Compass & SASS
/* Mixin for Compass - border-image
$border-image([$image-url], [$offsets], [$repeats])
Example:
@include border-image(url(../my_image.png), 10, stretch)
@include border-image(url(../my_image.png), 10 5 10 5, stretch repeat)
---------------------------------------- */
@mixin border-image($url, $offsets, $repeats) {
@jmwhittaker
jmwhittaker / Localhost in VMWare VM
Created March 14, 2011 15:22
Get localhost working in VMWare
Connect to your Mac's localhost from within a VMWare virtual machine.
- Boot up VMware and fire up your VM (i'm using Windows 7)
- Make sure that the VM is using NAT
- Fire up the command prompt in Windows and type "ipconfig". IN the resulting text look for your IPv4 address. It will be something like 192.168.xxx.xxx
- Now go to your browser in your VM and type that ip address into the url bar but change the last set of digits to be 2 (or 1).
- so as an example if your ip was found to be 192.168.213.200 change it to be 192.168.213.2
- Assuming that your localhost is running on your mac you should get your localhost in your VM browser.
- If you need to add a non standard port number on the end like 8090 go ahead and do so.
@jmwhittaker
jmwhittaker / Repair OSX Disk
Created March 31, 2011 10:27
If you ever get invalid node structure problem with disk
Boot up with OSX Disk.
Firstly try Disk Utility repair
Then if that does not work try (with the drive unmounted)
Open terminal and type:
/sbin/fsck_hfs -ypr /dev/disk0s2

A pure CSS bendy shadow:

I suspect that some trig calculations could make this very general.

bendy_shadow

@jmwhittaker
jmwhittaker / Rubberband scroll
Created January 9, 2012 17:29
Prevent 'rubber band' scrolling in Lion
/* To prevent rubber band scrolling in Lion */
body {
overflow:hidden;
height:100%;
}
/* Also look to add in -webkit-overflow-scrolling for touch iOS 5 < devices */
@jmwhittaker
jmwhittaker / gist:2107703
Created March 19, 2012 11:05
Center input placeholder text
::-webkit-input-placeholder,
input:-moz-placeholder {
text-align:center;
}
@jmwhittaker
jmwhittaker / crunchy_pubsub.js
Created May 9, 2012 17:28 — forked from plukevdh/crunchy_pubsub.js
Faux pubsub. Could also use jQuery event binding if you rather.
crunch.pubsub = _.extend({}, Backbone.Events);
// Hide backbone implementation by aliasing
crunch.pubsub.publish = crunch.pubsub.trigger;
crunch.pubsub.subscribe = crunch.pubsub.bind;
crunch.pubsub.unsubscribe = crunch.pubsub.unbind;