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}"
}
}
<?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) | |
// |
// 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(": "); |
// ---- | |
// 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}"
}
}
######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')); |
<?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. |