Skip to content

Instantly share code, notes, and snippets.

@jlebensold
jlebensold / Name.php
Created November 20, 2011 17:04
PUTting Data with jQuery
<?php
session_start();
if (!isset($_SESSION['names']))
$_SESSION['names'] = array("jane","jim","john","emily","bill","sara");
class Name
{
public $id;
@richtr
richtr / handbrake_nas.applescript
Last active January 1, 2017 23:00
Synology NAS (or any other AFP-based shared folder) to Handbrake auto-conversion of avi/mkv files to mp4
-- AppleScript that mounts an AFP service (e.g. a Synology NAS Diskstation) then
-- searches for any .avi or .mkv files in the requested volume and converts all
-- the files it finds to .mp4 via HandbrakeCLI (which must be installed on your
-- machine at /Applications/HandbrakeCLI)
-- IMPORTANT: You may need to make sure your NAS does not sleep until ~4 hours of
-- inactivity has passed so it doesn't interrupt the mp4 conversion process of
-- this script.
-- Based loosely on the script published at http://cybernetnews.com/batch-convert-videos-handbrake-applescript/
@Rarst
Rarst / RoboFile.php
Last active December 1, 2019 19:41
Robo command to build a release zip for Composer package.
<?php
class RoboFile extends \Robo\Tasks {
/**
* Creates release zip
*
* @param string $package Composer package in vendor/name format.
* @param string $version Version to build.
*/
@petenelson
petenelson / rest-api-restrict-media-endpoint.php
Created July 17, 2015 02:48
WordPress REST API: Restrict access to the media endpoint to only authenticated users
<?php
// restrict access to the media endpoint
add_action( 'init', function() {
// _add_extra_api_post_type_arguments() in the WP REST API sets this to true
// we'll turn it off for unauthenticated requests
global $wp_post_types;
$wp_post_types['attachment']->show_in_rest = is_user_logged_in();
@clemp6r
clemp6r / AzureStorageDeployTask.groovy
Last active May 11, 2021 05:34
Gradle task for deploying a file to Azure Blob Storage
package com.github.clemp6r.azuregradle
import org.gradle.api.DefaultTask
import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.blob.*
import org.gradle.api.tasks.TaskAction;
class AzureStorageDeployTask extends DefaultTask {
@Yavari
Yavari / README.markdown
Created February 23, 2012 09:00 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@nmackenzie
nmackenzie / LoadBalancedVM.ps1
Created October 25, 2015 19:23
Create a load-balanced pair of Azure VMs
$testName = "lower-case-unique-name"
$resourceGroupName = $testName
$location = "westus"
$domainName = $testName
$subnetName = "Subnet-1"
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServer"
$sku = "2012-R2-Datacenter"
@Maximilianos
Maximilianos / class-templater.php
Created February 12, 2016 14:51
Register custom page templates in WordPress programmatically in a plugin or in the theme without even requiring real template files.
<?php
/**
*
*/
/**
* Class MCF_Templater
*
* Based on work by Harri Bell-Thomas <https://github.com/HarriBellThomas>
@chrisjacob
chrisjacob / README.md
Created February 14, 2011 14:31
Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout - a step-by-step guide.

Intro

Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout.

IMPORTANT

If you plan on switching between different branches (e.g. git checkout master-experiment then revert back with git checkout master) you will loose your child folder from this tutorial (because it's in your .gitignore and is not part of your master branch).

@frntn
frntn / gist:f25726df962fc29c6dde
Last active November 1, 2023 15:18
azure-cli cheatsheet
azure
account
list [options] #List the imported subscriptions
show [options] [subscriptionNameOrId] #Show details about a subscription
set [options] <subscriptionNameOrId> #Set the current subscription
clear [options] #Remove a subscription or environment, or clear all of the stored account and environment info
import [options] <file> #Import a publishsettings file or certificate for your account
download [options] #Launch a browser to download your publishsettings file
env... #Commands to manage your account environment