Skip to content

Instantly share code, notes, and snippets.

@thomaswilburn
thomaswilburn / Code.gs
Created August 29, 2014 19:20
Apps Script example for handling custom forms
var sheetID = "xxx-id-goes-here-xxx";
var rowConfig = "timestamp name location favorite note lifespan season contact lat lng zone approve feature".split(" ");
/***
Requests may come in with the following parameters:
name
favorite - player name (number?)
note
@TylerFisher
TylerFisher / LICENSE
Last active August 29, 2015 14:08
This code will refresh all users on your webpage upon deployment of a timestamp.json file to S3. We used this to deploy hotfixes on election night for elections.npr.org. It requires Fabric (a Python library for running tasks on the command line) and jquery-cookie.js, but could easily be refactored to not.
The MIT License (MIT)
Copyright (c) 2014 NPR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@yurivictor
yurivictor / scrape.js
Created June 1, 2015 21:55
Example scraper in node (scraping rand paul's site for issues)
var cheerio = require('cheerio');
var request = require('request');
var fs = require('fs');
var s,
Scrape = {
settings: {
// Object, the json to be output
json: {},
// String, the url to scrape
@ericrasch
ericrasch / include-tweets.php
Created March 15, 2012 21:33
How to display your latest tweets in your WordPress site without a plugin
<?php
// How to display your latest tweets in your WordPress site without a plugin
// Source: http://dinolatoga.com/2010/07/31/how-to-display-your-latest-tweets-in-your-wordpress-blog-without-a-plugin/
include_once(ABSPATH . WPINC . '/feed.php');
//configuration
$username = "EricRasch"; // Just insert the username of the Twitter account you want to display
$feed = "http://twitter.com/statuses/user_timeline/$username.rss"; // Changed the code from dinolatoga.com to actually use the username variable
$num = 2; // Set the number of Tweets you want to display
@harrisj
harrisj / tinyurl_test.rb
Created April 26, 2012 16:44
Testing Punctuation on URL Shorteners
require 'net/http'
# These links were taken from my twitter timeline. No endorsement implied.
tiny_urls = {
'bitly' => ['http://bit.ly/3S9c5K', 'http://developer.nytimes.com/'],
'j.mp' => ['http://j.mp/JsML0u', 'http://www.npr.org/2012/04/26/151303230/an-african-trader-and-the-perils-of-business-in-china'],
'tinyurl' => ['http://tinyurl.com/6rq9vob', 'http://politicsoftheplate.com/?p=1283'],
'owly' => ['http://ow.ly/axesj', 'http://threatpost.com/en_us/blogs/opera-12-beta-released-new-security-features-including-do-not-track-support-042612'],
'ht.ly' => ['http://ht.ly/1j7LiX', 'http://rssfeeds.usatoday.com/~r/usatoday-LifeTopStories/~3/8vFV-fFfhAc/1'],
'is.gd' => ['http://is.gd/gk0FoM', 'http://www.wired.com/dangerroom/2012/04/joe-schmoe-drones/'],
@micahwave
micahwave / gist:3240092
Created August 2, 2012 19:53
tax query
$latest_galleries = wp_cache_get( 'latest_galleries', 'time_gallery_cache' );
if( !$latest_galleries ) {
$latest_galleries = get_posts( array(
'posts_per_page' => 6,
'post_status' => 'publish',
'tax_query' => array( array(
'taxonomy' => 'time_post_format',
'field' => 'slug',
@marcusandre
marcusandre / gen_appcache.md
Last active December 15, 2015 07:59
Generate Appcache (incl. xhr) in Chrome DevTools

Generate Appcache Manifest (incl. xhr) in Chrome DevTools

  1. Open your Chrome Developer Tools
  2. Navigate to the Network tab
  3. Just right click into the panel and choose Copy ALL as HAR (maybe the page needs a reload)
  4. Switch to the console tab and save your HAR data in a variable. (var data = cmd + v)
  5. Now let's create the cache manifest:
console.log('CACHE MANIFEST\n\nCACHE:');
<?php
// put this in functions.php or an include file
add_action( 'init', function() {
$fm = new Fieldmanager_Group( array(
'name' => 'contact_information',
'children' => array(
'name' => new Fieldmanager_Textfield( 'Name' ),
'phone_number' => new Fieldmanager_Textfield( 'Phone Number' ),
'website' => new Fieldmanager_Link( 'Website' ),
),
@tbranyen
tbranyen / em-attach.js
Created November 21, 2013 19:49
Automatically bind Ember Classes to the Application object with AMD.
/* Ember App Attach Plugin v0.1.0
* Copyright 2013, Tim Branyen (@tbranyen)
* ember-loader.js may be freely distributed under the MIT license.
*/
define(function(require, exports) {
exports.version = "0.1.0";
exports.load = function(name, req, load, config) {
var App = require("app");
@jlukic
jlukic / gist:8591765
Last active January 4, 2016 07:59
Nutrients backed by science

Nutrients and Supplements

Dosage Plans

Dosages listed for 150lb

Suggested Supplements