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
@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
@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')
@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 -->
@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' }
]
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@mauriciord
mauriciord / app.js
Last active January 26, 2017 12:56
Facebook request
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
//requestify
var requestify = require('requestify');
@molinto
molinto / activeCampaignAPI3.txt
Created April 19, 2016 11:21
Active Campaign API v3
API v3 known endpoints:
[GET with SESSION]
https://SUBDOMAIN.api-us1.com/api/3/tags
https://SUBDOMAIN.api-us1.com/api/3/tags/1
https://SUBDOMAIN.api-us1.com/api/3/contacts
https://SUBDOMAIN.api-us1.com/api/3/contacts/7
https://SUBDOMAIN.api-us1.com/api/3/deals
@javilobo8
javilobo8 / download-file.js
Last active May 13, 2025 05:55
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@smching
smching / app_mqtt.js
Last active May 20, 2025 11:41
Node.js application: Subscribe to all topics of a MQTT broker
var mqtt = require('mqtt');
var Topic = '#'; //subscribe to all topics
var Broker_URL = 'mqtt://192.168.1.123';
var options = {
clientId: 'MyMQTT',
port: 1883,
keepalive : 60
};