Skip to content

Instantly share code, notes, and snippets.

View commadelimited's full-sized avatar

Andy Matthews commadelimited

View GitHub Profile
@commadelimited
commadelimited / 2011-12-14-01.js
Created January 19, 2012 17:15
Refreshing jQuery Mobile widgets
$('body').prepend('<textarea id="myTextArea"></textarea>');
$('#myTextArea').textinput();
@commadelimited
commadelimited / 2011-12-14-02.js
Created January 19, 2012 17:16
Refreshing jQuery Mobile widgets
$('body').prepend('<input type="text" id="myTextField" />');
$('#myTextField').textinput();
@commadelimited
commadelimited / 2011-12-14-03.js
Created January 19, 2012 17:17
Refreshing jQuery Mobile widgets
$('body').append('<a href="" data-theme="e" id="myNewButton">testing</a>');
$('#myNewButton').button();
@commadelimited
commadelimited / 2011-12-14-04.js
Created January 19, 2012 17:18
Refreshing jQuery Mobile widgets
<label for="sCountry">Country:</label>
<select name="sCountry" id="sCountry">
<option value="">Where You Live:</option>
<option value="ad">Andorra</option>
<option value="ae">United Arab Emirates</option>
</select>
var myselect = $("#sCountry");
myselect[0].selectedIndex = 3;
myselect.selectmenu('refresh');
@commadelimited
commadelimited / 2011-12-14-06.js
Created January 19, 2012 17:19
Refreshing jQuery Mobile widgets
<div data-role="fieldcontain">
<label for="slider-2">Input slider:</label>
<input type="range" id="slider-2" value="25" min="0" max="100" />
</div>
$('#slider-2').val(80).slider('refresh');
@commadelimited
commadelimited / 2011-12-14-05.js
Created January 19, 2012 17:21
Refreshing jQuery Mobile widgets
<ul id="myList" data-role="listview" data-inset="true">
<li>Acura</li>
<li>Audi</li>
<li>BMW</li>
</ul>
$('#mylist').listview('refresh');
@commadelimited
commadelimited / 2011-12-14-07.js
Created January 19, 2012 17:21
Refreshing jQuery Mobile widgets
<div data-role="fieldcontain">
<label for="toggle">Flip switch:</label>
<select name="toggle" id="toggle" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>
</div>
var myswitch = $("#toggle");
myswitch[0].selectedIndex = 1;
@commadelimited
commadelimited / 2011-12-14-08.js
Created January 19, 2012 17:22
Refreshing jQuery Mobile widgets
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>Layout view:</legend>
<input type="radio" name="radio-view" value="list" />
<label for="radio-view-a">List</label>
<input type="radio" name="radio-view" value="grid" />
<label for="radio-view-b">Grid</label>
<input type="radio" name="radio-view" value="gallery" />
<label for="radio-view-c">Gallery</label>
</fieldset>
@commadelimited
commadelimited / 2011-12-14-09.js
Created January 19, 2012 17:22
Refreshing jQuery Mobile widgets
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>Agree to the terms:</legend>
<input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" />
<label for="checkbox-1">I agree</label>
</fieldset>
</div>
$('#checkbox-1').attr('checked',true).checkboxradio('refresh');
@commadelimited
commadelimited / 2011-11-25-01.jsx
Created January 19, 2012 19:24
Scripting Photoshop with ExtendScript
// bring Photoshop into focus
// This also allows you to simply double click the JSX file
#target photoshop
// set some default variables
var docRef = app.activeDocument;
// remember this is JavaScript. That means I can take
// input from a user in the form of a prompt. Awesome right?
var fileName = prompt('Please enter base file name', docRef.name);