Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
echo "Checking for migrations"
while [[ $(python manage.py showmigrations | grep '\[ \]') ]]; do
echo "--> Waiting for migrations to be applied..."
sleep 0.5
done
echo "OK migrations are ready"
exec "$@"
@drpancake
drpancake / index.ios.js
Last active April 3, 2022 20:34
React Native chat app with websockets
'use strict';
var React = require('react-native');
var {
AppRegistry,
Text,
TextInput,
ScrollView,
View
} = React;
@drpancake
drpancake / gist:9605830
Last active November 17, 2016 03:26
Manually long-polling the Atlas ATS API (Bayeux protocol)
# Requires the 'requests' module: http://docs.python-requests.org/en/latest/
import json
import requests
URL = 'https://data.atlasats.com:4000/api'
def bayeux_call(data):
headers = {'content-type': 'application/json'}
res = requests.post(URL, data=json.dumps(data), headers=headers, verify=False) # no SSL cert check
@drpancake
drpancake / gist:4265191
Created December 12, 2012 05:56
How to use a block instead of a selector for target-action.
UITapGestureRecognizer *recogizer = [[UITapGestureRecognizer alloc] initWithTarget:^{
NSLog(@"Hello!");
} action:@selector(invoke)];
[myView addGestureRecognizer:recogizer];