Skip to content

Instantly share code, notes, and snippets.

@mikeal
mikeal / gist:1840641
Created February 16, 2012 01:33
get a new/clean port with node.js
var portrange = 45032
function getPort (cb) {
var port = portrange
portrange += 1
var server = net.createServer()
server.listen(port, function (err) {
server.once('close', function () {
cb(port)
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active November 5, 2024 18:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jakemmarsh
jakemmarsh / controllers.js
Last active May 20, 2019 10:15
AngularJS Service with Controller for access to Google API with Javascript Client (and RequireJS)
define(['angular', 'services'], function (angular) {
'use strict';
return angular.module('myApp.controllers', ['myApp.services'])
.controller('IndexCtrl', ['$scope', 'googleService', function ($scope, googleService) {
$scope.login = function () {
googleService.login().then(function (data) {
// do something with returned data
console.log(data.email);
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active July 4, 2024 13:00
Backend Architectures Keywords and References
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active August 30, 2024 08:37
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@roldershaw
roldershaw / imsg
Last active March 1, 2022 19:34
Send iMessages from the command line using Bash and AppleScript
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Usage: imsg [address] [message]"
else
/usr/bin/osascript -e 'tell application "Messages"
send "'"$2"'" to buddy "'"$1"'" of service "E:[email protected]"
end tell'
echo "Sent"
fi
@stephen
stephen / gist:8488120
Last active January 3, 2016 16:18
Log of AirPlay send/received via AirSonos using Spotify (47 seconds of playback) from iPad Air (iOS 7) using AirSonos commit 6f8dd2086b
BEGIN BONJOUR ADVERTISING
INSPECTING HEADER @ 1390036591413
`--: OPTIONS * RTSP/1.0
`--: CSeq: 0
`--: X-Apple-Device-ID: 0xaccf5c73af4b
`--: Apple-Challenge: JWkfiX/5gzeKemPDHyBwww==
`--: DACP-ID: 21A3D7C25BB62248
`--: Active-Remote: 1588769825
`--: User-Agent: AirPlay/190.9
END HEADER

Keybase proof

I hereby claim:

  • I am stephen on github.
  • I am swan (https://keybase.io/swan) on keybase.
  • I have a public key whose fingerprint is 5252 D938 83A1 854B 90EF C3A0 6D14 0B75 E045 33C6

To claim this, I am signing this object:

@stephen
stephen / handles
Last active August 29, 2015 14:01
Twitter handles available from /usr/share/dict/words
testing 254164 handles
zythem
zymotoxic
zymotize
zymotically
zymotechnic
zymotechny
zymotechnical
zymosterol
zymosimeter