Skip to content

Instantly share code, notes, and snippets.

@sivel
sivel / test-head-footer.php
Created April 25, 2010 14:46
WordPress Plugin to test for the existence and functionality of wp_head and wp_footer in the active theme
@stomita
stomita / SimpleSalesforceConnection.js
Created May 25, 2011 08:40
A Google Apps Script, which simply connects and fetches data from Salesforce RESTful API with OAuth authentication.
/**
* Connect and fetch Salesforce data via OAuth
*/
function queryDataFromSalesforce() {
// Read OAuth consumer key / secret of this client app from script properties,
// which can be issued from Salesforce's remote access setting in advance.
var sfConsumerKey = ScriptProperties.getProperty("sfConsumerKey");
var sfConsumerSecret = ScriptProperties.getProperty("sfConsumerSecret");
if (!sfConsumerKey || !sfConsumerSecret) {
Browser.msgBox("Register Salesforce OAuth Consumer Key and Secret in Script Properties");
@alexeckermann
alexeckermann / category_list_block.rb
Created June 27, 2011 11:46
The Jekyll plugins used on alexeckermann.com
module Jekyll
class CategoryListBlock < Liquid::Block
include Liquid::StandardFilters
def render(context)
categories = context.registers[:site].categories.keys
result = []
context.stack do
@mhawksey
mhawksey / gist:1170597
Created August 25, 2011 13:02
Google Apps Script to fill in a Document template with Spreadsheet data
function onOpen() {
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}];
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Fitness Diaries", menuEntries);
}
function createDocFromSheet(){
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries
// get the data from an individual user
@ahgittin
ahgittin / jsonball.rb
Created February 23, 2012 21:57
a jekyll tag to parse json files and objects for use as maps subsequently
require 'json'
# JSON parser tag, creating map for use in jekyll markdown
# Alex.Heneveld @ Cloudsoft Corp (remove spaces and add the .com)
# Released under APL 2.0
# usage: {% jsonball varname from TYPE PARAM %}
#
# where TYPE is one of {data,var,file,page}, described below
@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@entaq
entaq / Google_oAuth.js
Created November 15, 2012 17:18
Google oAuth 2.0 sample
/**
reference -
https://developers.google.com/accounts/docs/OAuth2WebServer
https://code.google.com/apis/console/
https://developers.google.com/+/api/latest/
**/
////handle all requests here
function doGet(e) {
@Daniel15
Daniel15 / 1_README.md
Last active February 12, 2024 19:14
Complete Google Drive File Picker example

Google Drive File Picker Example

This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.

Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.

See a demo at http://stuff.dan.cx/js/filepicker/google/

<?php
/**
* @file
* Default theme implementation to display the basic html structure of a single
* Drupal page.
*
* Variables:
* - $css: An array of CSS files for the current page.
* - $language: (object) The language the site is being displayed in.