Skip to content

Instantly share code, notes, and snippets.

@tpthn
tpthn / gist:2251435
Created March 30, 2012 13:11
CSS - Keep bottom bar stay down
<body>
<div id="wrapper">
<div id="header"></div>
<div id="content"></div>
<div id="footer"></div>
</div>
</body>
<!----and the CSS------>
@tpthn
tpthn / gist:2251509
Created March 30, 2012 13:22
jQuery - .ajax() call example
//load example
p = {
username: username,
ext: ext
};
$('#defUsernameVal').load("<?= site_url('ams/checkUsername') ?>",p);
//post example
$.post("ajax.php", { api: "Report", f: "exportToCsv"},
@tpthn
tpthn / gist:2251592
Created March 30, 2012 13:33
CSS - Drop down menu
<!--HTML Portion-->
<ul id="nav">
<li class="current"><a href="#">Home</a></li>
<li><a href="#">Sub Menu</a>
<ul>
<li><a href="#">Submenu Item</a>
<ul>
<li><a href="#">Level 3 menu</a></li>
<li><a href="#">Level 3 menu</a></li>
</ul>
@tpthn
tpthn / gist:2251681
Created March 30, 2012 13:50
jQuery - Get multiple selected items from list
<select name="garden" multiple="multiple">
<option>Flowers</option>
<option selected="selected">Shrubs</option>
<option>Trees</option>
<option selected="selected">Bushes</option>
<option>Grass</option>
<option>Dirt</option>
</select>
@tpthn
tpthn / gist:2251723
Created March 30, 2012 13:58
jQuery - Direct link
//version specific
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
//always up to date
<script type='text/javascript' src='http://code.jquery.com/jquery-latest.js'></script>
//jquery ui
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
@tpthn
tpthn / gist:2280090
Created April 2, 2012 02:20
javascript - view source of web page
//type this in the url field after page load
javascript:alert(document.documentElement.innerHTML);
@tpthn
tpthn / gist:2993371
Created June 26, 2012 04:51
jQuery wordpress wrapper
(function($) {
// $ Works! You can test it with next line if you like
// console.log($);
})( jQuery );
@tpthn
tpthn / gist:3054424
Created July 5, 2012 15:41
jQuery - trigger enter on button for textbox input
$("#id_of_textbox").keyup(function(event){
if(event.keyCode == 13){
$("#id_of_button").click();
}
});
@tpthn
tpthn / gist:3060544
Created July 6, 2012 14:37
CSS - Styling dropdown
//HTML part
<div class="select-wrapper">
<select id="search_filter">
<option value='username'>Username (recommended)</option>
<option value='lastname'>Lastname</option>
</select>
</div>
@tpthn
tpthn / UIView Element - UISlider
Created August 10, 2012 20:27
iOS - Some basic info about UISlider
//setup a UISlider programmatically
mySlider = [[[UISlider alloc] initWithFrame:CGRectMake(174, 12, 120, 23)] autorelease];
mySlider.maximumValue = 100;
mySlider.minimumValue = 30;
mySlider.value = 100;
[mySlider addTarget:self action:@selector(dimScreen:) forControlEvents:UIControlEventValueChanged];
//adding the slider to a table cell
cell.textLabel.text = @"My Slider";
cell.accessoryView = mySlider;