Skip to content

Instantly share code, notes, and snippets.

View kylerberry's full-sized avatar

Kyler Berry kylerberry

View GitHub Profile
@kylerberry
kylerberry / gist:3866864
Created October 10, 2012 16:53 — forked from karolhor/gist:2006508
XHTML: Transitional Template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<title></title>
@kylerberry
kylerberry / html5_template.html
Created October 10, 2012 16:55 — forked from nathansmith/html5_template.html
Simple HTML5 Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1" />
<title>untitled</title>
<link rel="stylesheet" href="" />
</head>
<body>
@kylerberry
kylerberry / reset.css
Created October 10, 2012 17:05
Reset CSS
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@kylerberry
kylerberry / Simple CSS Template
Created October 10, 2012 17:13
A simple CSS template
@charset "UTF-8";
/*-----------------------------
IMPORT
------------------------------*/
@import url("css/reset.css");
/*-----------------------------
GLOBAL
@kylerberry
kylerberry / Xcode:showDatabaseContents
Created October 15, 2012 23:11
Read from database and write to console
-(void)showDatabaseContents {
NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [path objectAtIndex:0];
NSString *pathToDB = [documentsDirectory stringByAppendingString:@"/classes.sqlite"];
// NSString *pathToDB = [[NSBundle mainBundle] pathForResource:@"classes" ofType:@"sqlite"];
FMDatabase *db = [FMDatabase databaseWithPath:pathToDB];
@kylerberry
kylerberry / gist:4683759
Created January 31, 2013 15:37
Basic AJAX Request
<script type="text/javascript">
function prepareForm() {
var form = document.getElementsByTagName('form');
form[0].addEventListener('submit', function(e) {
e.preventDefault();
var queryString = '?';
document.getElementById('output').innerHTML = "";
//contains an array of all <input> elements
@kylerberry
kylerberry / gist:5005998
Created February 21, 2013 16:35
Kyle Schaeffer's Perfect jQuery AJAX Request
$.ajax({
type: 'POST',
url: 'http://kyleschaeffer.com/feed/',
data: { postVar1: 'theValue1', postVar2: 'theValue2' },
beforeSend:function(){
// this is where we append a loading image
$('#ajax-panel').html('<div class="loading"><img src="/images/loading.gif" alt="Loading..." /></div>');
},
success:function(data){
// successful request; do something with the data
$url = "http://www.example.org/";
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $url);
$data = curl_exec($curl);
curl_close($curl);
@kylerberry
kylerberry / Responsive Navigation
Last active December 14, 2015 09:39
Responsive Navigation: dropdown at small-screens, horizontal at larger screens
<!--
Based on code and examples by Terris Kremer
http://themetaq.com/articles/responsive-toggle-menu
-->
<!----------------------- html ----------------------->
<!-- //for wordpress navigation -->
<nav>
<h2 class="toggle-menu">Navigation<span></span></h2>
<?php wp_nav_menu(array('menu' =>'your_menu', 'menu_class' => 'navigation', 'container' => 'false')); ?>
@kylerberry
kylerberry / gist:5109102
Created March 7, 2013 16:02
jQuery: position:fixed Android Fix
<script>
$(document).ready( function() {
var fixedElement = $('.fixedElement');
$(window).resize(function(){
$(menu).remove();
$('body').append(fixedElement);
});
});
</script>