Skip to content

Instantly share code, notes, and snippets.

@ram-nadella
ram-nadella / api_testing_framework.php
Created September 10, 2011 01:12
For testing CloudFlare app integration
<?php
// Code Sample for the CloudFlare App API
// Copyright (c) 2011 by CloudFlare, Inc.
// All Rights Reserved.
//
// You may use these Code Samples for any purpose, commercial or otherwise, provided that you
// adhere to the disclaimer at the bottom of this document. You must also require any transferee of this
// Code Sample to abide by the terms of the disclaimer.
//

Release Notes

Version 0.1

Enter domain and click the Dig button to see the output of dig

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Ozone</title>
<link>https://raw.github.com/gist/2795631/90a1d60ab71387c42694fa4b6335c37f51255fc2/ozone_appcast.xml</link>
<description>Helper tool</description>
<language>en</language>
<item>
<title>Version 0.1</title>
<sparkle:releaseNotesLink>
@ram-nadella
ram-nadella / php_implode_fail.php
Created August 22, 2012 01:29
PHP implode fails when it encounters objects which don't implement __toString()
<?php
$data = array(
"one" => 1,
"text" => "",
"obj" => (object) array("key" => "value")
);
var_dump($data);
@ram-nadella
ram-nadella / cloudflare.json
Created November 2, 2012 23:08
Sample CloudFlare app manifest file
{
"manifest_version": "2",
"name": "App name (max 64 chars)",
"description": "A line or two about what the app does (max 200 characters)",
"version": "2.7",
"config": {
"category": "Web Analytics",
"languages": ["English", "German", "list of languages your app supports"],
"restrictions": "Any restrictions that users should know about, eg. US websites only or just say None",
"tos": "http://service.com/terms_of_service_url",
@ram-nadella
ram-nadella / watch_apps.rb
Created January 10, 2013 00:14
Watch the apps folder in cf-www and run jake to regenerate the minified and concatenated JS file. Send a Growl notification when done.
#!/usr/bin/env ruby
require "rubygems"
require "fssm"
require "ruby-growl"
=begin
Watch apps js files for changes and automatically generate
a merged cloudflare-apps.js file using jake
@ram-nadella
ram-nadella / countries_iso_code_name.json
Created September 28, 2013 02:38
JSON array of country ISO code to country name map
[
{"iso" : "AF", "country" : "Afghanistan"},
{"iso" : "AL", "country" : "Albania"},
{"iso" : "DZ", "country" : "Algeria"},
{"iso" : "AS", "country" : "American Samoa"},
{"iso" : "AD", "country" : "Andorra"},
{"iso" : "AO", "country" : "Angola"},
{"iso" : "AI", "country" : "Anguilla"},
{"iso" : "AQ", "country" : "Antarctica"},
{"iso" : "AG", "country" : "Antigua and Barbuda"},
<?php
ini_set('display_errors', 0);
$a = "á";
$b = substr($a, 0, 1);
$c = json_encode(array("b" => $b));
var_dump($c);
?>

?gist

?gist <number>

?gist 1111177
https://github.etsycorp.com/gist/anonymous/1111177

FIN

~]> sudo sh -x /etc/init.d/memcached restart
[sudo] password for rnadella:
+ . /etc/init.d/functions
++ TEXTDOMAIN=initscripts
++ umask 022
++ PATH=/sbin:/usr/sbin:/bin:/usr/bin
++ export PATH
++ '[' -z '' ']'
++ COLUMNS=80
++ '[' -z '' ']'