Skip to content

Instantly share code, notes, and snippets.

View dhrrgn's full-sized avatar
🦙

Dan Horrigan dhrrgn

🦙
  • OH, USA
  • 00:50 (UTC -04:00)
View GitHub Profile
/**
* @providesModule PusherClient
*/
"use strict";
import React from 'react-native';
var {
NativeAppEventEmitter,
NativeModules: {
PusherClient,
<?php
/**
* Gets the HTTP status code for the given URL.
*
* @param string $url The URL to check.
* @return int
*/
function url_http_status($url) {
$ch = curl_init($url);
@dhrrgn
dhrrgn / oembed.php
Last active August 29, 2015 13:57
<?php
$url = 'https://twitter.com/dhrrgn/status/440968615697715200';
$embedly = new Embedly\Embedly([
'key' => getenv('EMBEDLY_KEY'),
]);
if (preg_match('#https?://(?:www.)?twitter.com/[^/]+/status/([0-9]+)#i', $url, $match)) {
$oembed = json_decode(file_get_contents('https://api.twitter.com/1/statuses/oembed.json?id='.$match[1]), true);
DROP TRIGGER IF EXISTS touch_updated_ones;
CREATE TRIGGER touch_updated_ones BEFORE UPDATE ON `super_secret_table_name`
FOR EACH ROW SET NEW.touched = UNIX_TIMESTAMP();
DROP TRIGGER IF EXISTS touch_new_ones;
CREATE TRIGGER touch_new_ones BEFORE INSERT ON `super_secret_table_name`
FOR EACH ROW SET NEW.touched = UNIX_TIMESTAMP();
@dhrrgn
dhrrgn / sixpack.conf
Last active August 29, 2015 13:57
Sixpack Supervisor Config
[program:sixpack_server]
command=gunicorn --access-logfile - -w 8 -b 127.0.0.1:5000 --worker-class=gevent sixpack.server:start
user=nobody
autostart=true
autorestart=true
environment=SIXPACK_CONFIG="/etc/sixpack/config.yml"
[program:sixpack_web]
command=gunicorn --access-logfile - -w 2 -b 127.0.0.1:5001 --worker-class=gevent sixpack.web:start
user=nobody
@dhrrgn
dhrrgn / site.conf
Last active August 29, 2015 13:57
Sixpack Server Nginx Proxy with SSL
server {
listen 80;
server_name sixpack-server.myserver.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name sixpack-server.myserver.com;
ssl_certificate /etc/nginx/ssl/sixpack-server.myserver.com.chained.crt;
ssl_certificate_key /etc/nginx/ssl/sixpack-server.myserver.com.key;
[www]
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
pm = dynamic
pm.max_children = 24
pm.start_servers = 2
<?php
use Orno\Http\Request;
use Orno\Http\Response;
class Controller
{
public function __construct(Request $request)
{
$this->request = $request;

Keybase proof

I hereby claim:

  • I am dhrrgn on github.
  • I am dhrrgn (https://keybase.io/dhrrgn) on keybase.
  • I have a public key whose fingerprint is 4915 15BA B7ED 4721 B523 6003 228D FBB1 C6EF D089

To claim this, I am signing this object:

location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}