Skip to content

Instantly share code, notes, and snippets.

View travismillerweb's full-sized avatar

Travis Miller travismillerweb

View GitHub Profile
<?php
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)
// $description - text description of the event
// $filename - the name of this file for saving (e.g. my-event-name.ics)
//
<!doctype html>
<!-- Helpful things to keep in your <head/>
// Shi Chuan, https://github.com/shichuan/mobile-html5-boilerplate
-->
<head>
<!-- consider using below meta tags if you want to disable format detection by default -->
<meta name="format-detection" content="telephone=no"/>
<meta name="format-detection" content="address=no"/>
<!-- consider using below link tag if the page is duplicate content of a desktop version -->
@travismillerweb
travismillerweb / 0_reuse_code.js
Created December 3, 2013 20:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@travismillerweb
travismillerweb / SassMeister-input.sass
Created January 30, 2014 05:54 — forked from scottkellum/SassMeister-input.sass
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.7)
// ----
=e($name)
@at-root #{&}__#{$name}
@content
=m($name)
@at-root #{&}--#{$name}
// Sticky Footer CSS
// http://www.cssstickyfooter.com/
$sticky-footer-height: 80px; // must be same height as the footer
* {
margin: 0;
padding: 0;
}

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

[
    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
      }
 }

PDO (PHP Data Objects)

######Cheat sheet for using PDO to interact with MySQL db's


Used to use MySQL then found out it was being depreciated, this is of course right after I got the hang of it and was almost finished with the project i was using to learn myself. So desided to make the switch to PDO way much easier especially if you have security in mind.

For instance instead of $var = mysql_real_escape_string($_POST['data'];, you just $var = $db->quote($_POST['data'];. Or even better use prepared staements and the underlying driver will not only escape but quote the string for you!

<html>
<head></head>
<body>
<!-- NOTE: ?api=1 and player_id at the end of the URL -->
<iframe id="player" width="" height="" src="http://player.vimeo.com/video/62207569?api=1&player_id=player" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>
<script>
var player = $f(document.getElementById('player'));
@travismillerweb
travismillerweb / list-custom-post-type-posts-with-ajax.PHP
Created October 7, 2021 13:33 — forked from mikeschinkel/list-custom-post-type-posts-with-ajax.PHP
Shows how to create a widget with a dropdown list of posts for a given post type and then retrieve HTML specific to the selected post via AJAX to insert into the page.
<?php
/*
List_Custom_Post_Type_Posts_with_AJAX class.
Shows how to create a widget with a dropdown list of posts for a given post type and
then retrieve HTML specific to the selected post via AJAX to insert into the page.
Yes, the name of the class is insanely long in hopes that you'll be forced to think
about what would be a better name.