Skip to content

Instantly share code, notes, and snippets.

View molinto's full-sized avatar
🎯
Focusing

Sharry Stowell molinto

🎯
Focusing
  • Molinto
  • United Kingdom
View GitHub Profile
@mpj
mpj / 0-array.js
Last active May 25, 2023 15:48
Code to the video - "Map: Part 2 of Functional Programming in JavaScript"
var animals = [
{ name: 'Fluffykins', species: 'rabbit' },
{ name: 'Caro', species: 'dog' },
{ name: 'Hamilton', species: 'dog' },
{ name: 'Harold', species: 'fish' },
{ name: 'Ursula', species: 'cat' },
{ name: 'Jimmy', species: 'fish' }
]
@polimorfico
polimorfico / quaderno-subscriptions-for-paypal.html
Last active August 29, 2015 14:22
Create a PayPal subscriptions with Quaderno.js
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Quaderno.js for PayPal Subscriptions</title>
<!-- jQuery is used only for this example; it isn't required to use Quaderno -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- The required Quaderno lib -->
@nackjicholson
nackjicholson / injection-spec.js
Created April 26, 2015 02:27
Better tests, proxyquire vs injection vs mockless
var assert = require('assert')
var sinon = require('sinon')
var dependency = require('dependency')
var sut = require('./injection-sut')
describe('sut', function () {
var methodStub
beforeEach(function () {
methodStub = sinon.stub(dependency, 'method')
@Bo0m
Bo0m / shared_cookies.php
Created April 7, 2015 20:55
Storing cookies from a PHP CURL session outside of the cookie jar.
<?php
/**
* A quick example of storing CURL cookies outside of a local cookie jar file.
* Can be very useful for retaining API sessions between distributed applications.
**/
// Split out cookies from CURL response
function splitCookies($rawResponse, &$cookieData)
{
// Separate header and body
@polimorfico
polimorfico / quaderno-subscriptions-for-stripe.html
Last active January 30, 2018 17:37
Create a Stripe subscription with Quaderno.js
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Quaderno.js for Stripe Subscriptions</title>
<!-- jQuery is used only for this example; it isn't required to use Quaderno -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- The required libs -->
location ~ ^/(assets|fonts|pdfs)/ {
try_files $uri @rgts;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@kelvinn
kelvinn / cmd.sh
Created July 24, 2014 02:55
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@parsley72
parsley72 / keeniolocationmap.html
Last active March 9, 2016 07:34
Very basic demo of how to display Keen.io locations on a Google map. I've left out my Project ID and Read Key (for obvious reasons) so to get it to work you need to replace [PROJECT ID], [READ KEY] and [EVENT COLLECTION] with your own settings. Alternatively, go to the Keen.io Workbench for your project, select the Event Collection, set Analysis…
<!DOCTYPE html>
<html>
<head>
<title>Keen.io location map</title>
<style>
#map-canvas {
min-height: 400px;
width: 100%;