Skip to content

Instantly share code, notes, and snippets.

@andrewpbrett
andrewpbrett / ofn-global-stats.sh
Created May 3, 2021 18:58 — forked from mkllnk/ofn-global-stats.sh
OFN global key stats
sql='
SELECT
SUBSTRING(CONCAT(completed_at) from 1 for 7) AS month,
COUNT(DISTINCT distributor_id) AS shops,
COUNT(DISTINCT email) AS customers,
COUNT(o.id) AS orders,
SUM(o.total) AS VALUE
FROM spree_orders o
WHERE o.completed_at >= DATE_TRUNC($$year$$, now() - interval $$1 year$$)
AND o.state = $$complete$$ GROUP BY month ORDER BY month;

Keybase proof

I hereby claim:

  • I am andrewpbrett on github.
  • I am andrewpbrett (https://keybase.io/andrewpbrett) on keybase.
  • I have a public key ASDd5LCtn9pyrwc7dlZWJKRW1AUpoa64HdAuZi7f5Kvucwo

To claim this, I am signing this object:

require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'cgi'
require 'redis'
require 'httparty'
auth_token = YOUR PINBOARD TOKEN
pocket_username = YOUR POCKET USERNAME
page = Nokogiri::HTML(open("https://getpocket.com/@#{pocket_username}"))
<?php
$s = @file_get_contents('php://input');
file_put_contents("/var/www/hackathon/camera.jpg", $s);
?>
validDatapoint: function(datapoint) {
var re = /^\s*((?:(?:\d{1,2})\s+){1,3}|\^+\s+)((?:(?:\+|\-)?(?:\d+\.?\d*|\d*\.?\d+))|(?:\d+st[\d\.]*)|(?:(\d+)\:(\d\d)(?:\:(\d\d))?))(\s+\".*?\")?\s*$/;
if(datapoint.length > 0 && !re.test(datapoint)) {
return false;
}
else if (datapoint.match(re) &&
($.trim(datapoint.match(re)[1]) - 0 < 1 ||
$.trim(datapoint.match(re)[1]) - 0 > 31)) {
return false;
}
describe User do
it "should add a user to an enrollment" do
plan = Plan.create(:name => "Aetna PPO")
don = User.create(:name => "Don")
don.plans << plan
don.enrollments.size.should == 1
betty = User.create(:name => "Betty")
betty.coenroll_with(don)
betty.enrollments.size.should == 1
don.cousers.should include(betty)
# Simple script to send you email when someone unfollows you on twitter.
#
# Replace email on line 24 with the email you want to receive notifications at, and
# twitter handle on line 23 with your own (or whomever you want to track unfollows for).
#
# Set up a crontab to check however often you like. If someone follows and then unfollows you
# very quickly (within the interval), you won't get an email.
#
# Requires that you can send mail from the command line of the environment where
# you're running the script using mailx, e.g. `echo "body" | mailx -s "subject" foo@bar.com