Skip to content

Instantly share code, notes, and snippets.

<?php
// Stampr Mailing Hello World in PHP!
require 'vendor/autoload.php';
require 'src/Stampr/Stampr.php';
$stampr_login = "your.stampr.login@example.com";
$stampr_password = "your.stampr.password";
$endpoint = "https://stam.pr/api";
<?php
// Stampr API - Create a Batch for Testing
require 'vendor/autoload.php';
require 'src/Stampr/Stampr.php';
$stampr_login = "your.stampr.login@example.com";
$stampr_password = "your.stampr.password";
$endpoint = "https://stam.pr/api";
@cmawhorter
cmawhorter / async-download.js
Created July 10, 2014 18:32
Downloads all files in an array 2 at a time
var fs = require('fs');
var path = require('path');
var async = require('async');
var request = require('request');
var tasks = {};
var json = { /* your records */ };
@cmawhorter
cmawhorter / convert-to-svg.bat
Last active August 29, 2015 14:03
Converts all (vector) files in a directory to svg using ps2pdf, uniconvertor and inkscape.
@echo off
REM This will fail with "the input line is too long" if you have a lot of files... maybe?
REM Don't know why, but I think the solution is breaking the body of the for () into a separate
REM batch. But... IDGAF.
echo Starting...
for %%i in (*.*) do (
echo Looking at... %%~di%%~pi%%~ni%%~xi
@cmawhorter
cmawhorter / tiptop-overloads.js
Created August 12, 2014 01:56
All the joy of loose typing, combined with a little more strictness
// Playing with overloads and stricter typing in JS -- https://github.com/cmawhorter/tiptop
var fn = require('../lib/tiptop');
function MyObj() {
}
MyObj.prototype.save = fn.overloaded(
function() {
<div class="row">
<div class="col">8/27 9:21 AM</div>
<!-- calculateHeight(...) returns something like '112px' -->
<div class="col" ng-style="{ height: calculateHeight(statusStart, statusStop) }">
Prep Name (Prep)
Screens Burned
</div>
<div class="col">
<!-- placeholder for sub-status changes, like printing statuses -->
</div>
REM What is the working directory of this script?
REM Reports will be relative to that.
if not exist reports echo "no" && mkdir reports
cd reports
type nul > report.xml
REM this is probably the source of your problem
REM echo ^<?xml version="1.0" encoding="UTF-8"?> >> report.xml
@cmawhorter
cmawhorter / cors-xhr-html.js
Created October 20, 2014 22:31
CORS XHR request of remote HTML with credentials, using jquery
// Description: This details how to make a CORS XHR request to a remote HTML resource with credentials, using jquery
// Origin website: https://www.origin.example/hello.html
// Remote resource: https://www.remote.example/world.html
// You can test this locally by configuring your local web server to allow cross origin requests from
// google.com. Then you can run the snippet below in devtools from the google homepage.
// Remote resource prerequisites:
//
@cmawhorter
cmawhorter / init-dev.sh
Created November 17, 2014 18:32
Configure a cordova environment to use Crosswalk and be capable of building either ARM or x86 binaries
#!/usr/bin/env sh
# Expects this dir structure:
# libs (tip: symlink these)
# crosswalk_x86
# crosswalk_arm
# src
# client
# ...
# hooks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.