Skip to content

Instantly share code, notes, and snippets.

@johanneswuerbach
johanneswuerbach / .travis.yml
Last active April 14, 2023 20:31
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@jonhyman
jonhyman / BSONIdGenerator.h
Last active April 17, 2018 18:32
BSON Object Id generator in Objective-C
/*
# Copyright 2018 Jon Hyman
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@SebCorbin
SebCorbin / mymodule.php
Created May 12, 2012 22:53
Send pending approval mails to all users who have the 'administer users' permission
<?php
/**
* Implements hook_mail_alter().
*
* Also send pending approval mails to users who have
* the 'administer users' permission
*
* @see _user_mail_notify()
*/
@tbranyen
tbranyen / install_node.sh
Created May 1, 2012 16:27
Easily install new or old versions of Node.js on an OS X machine.
#!/bin/bash
#
# Copyright 2012, Tim Branyen @tbranyen <tim@tabdeveloper.com>
# Dual licensed under the MIT and GPL licenses.
#
# Easily install new or old versions of Node.js on an OS X machine.
#
# Install: curl -o /usr/local/bin/install_node https://gist.github.com/raw/2569416/install_node.sh
# chmod +x /usr/local/bin/install_node
#
@boundsj
boundsj / create_template_postgis.sh
Created March 13, 2012 14:24
Create the postgis template on a mac that had postgis installed from brew
# path taken from brew install notes
POSTGIS_SQL_PATH=/usr/local/share/postgis
# Creating the template spatial database.
createdb -E UTF8 template_postgis
createlang -d template_postgis plpgsql # Adding PLPGSQL language support.
# Allows non-superusers the ability to create from this template
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
@boundsj
boundsj / .profile
Created March 13, 2012 04:28
My .profile
################################################################
# jesse's .profile
################################################################
# set path so that the bin folder that brew uses comes before
# the /usr/bin
PATH=/usr/local/bin:$PATH
@fabiomcosta
fabiomcosta / sync-settimout-snippet.js
Created August 26, 2011 21:06
Mocks the setTimeout function with jasmine, making setTimeout dependent tests synchronous and easier to test.
// inside your beforeEach hook
spyOn(window, 'setTimeout').andCallFake(function(fn){
fn.apply(null, [].slice.call(arguments, 2));
return +new Date;
});
...
@revolunet
revolunet / extractGifs.py
Created March 1, 2011 09:48
extract frames from animated gif using python+PIL
import os
from PIL import Image
def extractFrames(inGif, outFolder):
frame = Image.open(inGif)
nframes = 0
while frame:
frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF')
nframes += 1
@daaku
daaku / facebook-sample.php
Created February 9, 2011 06:18
A simple Facebook PHP example.
<?php
/**
* A simple Facebook PHP example.
*
* - This is not a "Facebook SDK".
* - This example uses Curl, Hash, JSON, Session extensions.
* - This does not use the JavaScript SDK, nor the cookie set by it.
* - This works with Canvas, Page Tabs with IFrames, the Registration Plugin
* and with any other flow which uses the signed_request.
@kentbrew
kentbrew / node-on-ec2-port-80.md
Last active February 4, 2024 19:14
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);