Skip to content

Instantly share code, notes, and snippets.

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@krogsgard
krogsgard / events-labels.php
Created June 22, 2012 16:03
Change The Events Calendar labels
<?php
add_filter( 'gettext', 'krogs_event_change_venue_name', 20, 3 );
/**
* Change comment form default field names.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function krogs_event_change_venue_name( $translated_text, $text, $domain ) {
@jaredatch
jaredatch / global.js
Created June 29, 2012 03:38
Mobile Genesis menus
jQuery(document).ready(function($){
// Mobile navigation
$('#prim-selector, #sec-selector').change(function(){
if ($(this).val()!='') {
window.location.href=$(this).val();
}
});
});
@norcross
norcross / backend-page-query.php
Created September 11, 2012 14:11
Get pages inside CMB class
case 'page_select':
echo '<select name="', $field['id'], '" id="', $field['id'], '">';
$linked_items = get_posts(array(
'post_type' => array ('page',),
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'modified',
'order' => 'DESC'
));
foreach ($linked_items as $linked_item) {
@wpsmith
wpsmith / sm-annotated.html
Created October 22, 2015 16:25 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
<?php
/*
Plugin Name: Unplugged Mobile Theme
Plugin URI: http://www.rachelbaker.me
Description: A plugin and theme for WordPress that automatically reformats your blog's content for optimized viewing on Apple's <a href="http://www.apple.com/unplugged/">unplugged</a> and <a href="http://www.apple.com/ipodtouch/">iPod touch</a>.
Author: Rachel Baker
Version: 0.1
Author URI: http://www.rachelbaker.me
# Special thanks to Imthiaz Rafiq and the wp-pda Plugin (http://imthi.com/wp-pda/) which this plugin is derived from.
@vgrem
vgrem / UserCustomActions.ps1
Created September 24, 2014 20:43
How to utilize User Custom Actions using SharePoint CSOM
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
Function Get-SPOCredentials([string]$UserName,[string]$Password)
{
if([string]::IsNullOrEmpty($Password)) {
$SecurePassword = Read-Host -Prompt "Enter the password" -AsSecureString
}
@daniel-c05
daniel-c05 / minimize-over-delivery.js
Last active June 4, 2016 01:22
AdWords Scripts - Minimize Overdelivery
//Edit this based on the max amount you want to spend on a given day.
var maxSpend = 1000;
function main () {
var currentAccount = AdWordsApp.currentAccount();
var stats = currentAccount.getStatsFor("TODAY");
var cost = stats.getCost();
Logger.log("Account has spent " + cost + " so far.");
if (cost > maxSpend) {
campaign.pause();
@mattboon
mattboon / webfont-localstorage.js
Last active June 26, 2016 02:09
webfont-localstorage.js
function supportsWoff2() {
"use strict";
/*global FontFace*/
// Source: https://github.com/filamentgroup/woff2-feature-test
if (!window.FontFace) {
return false;
} else {
var f = new FontFace('t', 'url("data:application/font-woff2,") format("woff2")', {});
f.load();
return f.status === 'loading';
@wpscholar
wpscholar / get-post-types-supporting.php
Last active September 4, 2016 08:52
A custom WordPress function to fetch a list of registered post types that support a specific feature.
<?php
/**
* Get a list of post types that support a specific feature.
*
* @param $feature
* @return array
*/
function get_post_types_supporting( $feature ) {
global $_wp_post_type_features;