Skip to content

Instantly share code, notes, and snippets.

def update_ducksboard
api_key = ""
api_secret = ""
url = "https://#{api_key}:#{api_secret}@api.preact.io/api/v2/insights/health"
data = RestClient.get "#{url}", :content_type => :json, :accept => :json
accounts = data["accounts"]
# boxes
push_duck("YOUR_DATAPOINT_ID", accounts["good"]) # good account health
@azcoov
azcoov / preact.cs
Created May 16, 2013 23:51
Example C# Preact Logging Helper
// TODO - update the doc to use your own internal User model class, instead of the example UserInfo class.
public static class Preact
{
public static void LogEvent(UserInfo user, string eventName, string note = null)
{
try
{
Preact.Api.Client.LogEvent(new Preact.ActionEventCreateRequest()
{
#!/usr/bin/env ruby
# Libraries:::::::::::::::::::::::::::::::::::::::::::::::::::::::
require 'rubygems'
require 'sinatra/base'
require 'slim'
require 'sass'
require 'coffee-script'
# Application:::::::::::::::::::::::::::::::::::::::::::::::::::
@azcoov
azcoov / stripe_test.cs
Created April 13, 2013 15:47
Stripe with C#
using System;
using Xamarin.Payments.Stripe;
namespace XamarinStripeTest
{
class Program
{
static void Main(string[] args)
{
var payment = new StripePayment("your_private_test_key");
@azcoov
azcoov / gone_fishing.rb
Created April 12, 2013 21:28
Stripe Tweet Stream
TweetStream::Daemon.new('tweetstream').on_error do |message|
puts "error: #{message}"
end.on_reconnect do |timeout, retries|
puts "reconnecting..."
end.track('stripe') do |status|
puts "@#{status.user.screen_name}: #{status.text}"
status.user_mentions.each do |mention|
puts "user #{mention.screen_name} was mentioned."
end
end
@azcoov
azcoov / new.html.haml
Last active June 25, 2019 13:25
Stripe Checkout Form in HAML
= form_tag charges_path do
%article
%label{:class => "amount"}
%span Amount: $5.00
= javascript_include_tag "https://checkout.stripe.com/v2/checkout.js",
:class => "stripe-button",
:"data-key" => "#{Rails.configuration.stripe[:publishable_key]}",
:"data-description" => "30-day free trial",
@azcoov
azcoov / neglect.rb
Last active December 11, 2015 23:09 — forked from gooley/neglect.rb
Sample ruby helper method for the Less Neglect Ruby Gem
# TODO - make sure you have the 'lessneglect' gem installed
# https://github.com/lessneglect/lessneglect-ruby
require 'lessneglect'
class Neglect
def self.api
# TODO - replace with your Less Neglect API credentials
@@api ||= LessNeglectApi::Client.new({
:code => "asdfasdf",
@azcoov
azcoov / README.md
Last active December 11, 2015 01:08 — forked from mbostock/.block
@azcoov
azcoov / webscriptpush
Created November 17, 2012 23:05
push notification with webscript.io
local UA_APPKEY = '<Your Urban Airship App Key>'
local UA_PUSHSECRET = '<Your Urban Airship MASTER App Secret>'
local UA_PUSHURL = 'https://go.urbanairship.com/api/push/'
local STRIPE_KEY = '<Your Stripe Secret Key>'
local request_body = json.parse(request.body)
local id = request_body.id
local event = json.parse(http.request {
url = 'https://api.stripe.com/v1/events/' .. id,
auth = {STRIPE_KEY, ''}
@azcoov
azcoov / lessneglect.lib.php
Created November 13, 2012 20:59 — forked from DeviaVir/lessneglect.lib.php
A PHP library for the lessneglect.com API
<?PHP
Class LN {
// API credentials
private static $api_key = '';
private static $api_secret = '';
// Production (no sandboxed version available yet)
private static $api_url = 'https://lessneglect.com/api/v2/';
// Show debug messages?