Skip to content

Instantly share code, notes, and snippets.

View dominic's full-sized avatar
🐈
look it's a cat

Dominic Dagradi dominic

🐈
look it's a cat
View GitHub Profile

Keybase proof

I hereby claim:

  • I am dominic on github.
  • I am ddagradi (https://keybase.io/ddagradi) on keybase.
  • I have a public key ASBdNnP9t1EraaQSn42uFhXMh3Cu5QM2wZqDxrT9wXyePAo

To claim this, I am signing this object:

@dominic
dominic / ifelse.py
Last active December 20, 2015 15:08
How to remove branching logic in Python
"""
Before
"""
...
if lex_token['id']=='INT':
yield LiteralToken(lex_token['value'])
elif lex_token['id']=='ADD_OP':
yield OperatorAddToken()
elif lex_token['id']=='SUB_OP':
@dominic
dominic / bin-start
Created July 23, 2013 17:34
bin/start script for local development with ryandotsmith/nginx-buildpack
# Server command
COMMAND='bundle exec unicorn -p $PORT -c ./config/unicorn.rb'
if [[ $NGINX == "true" ]]
then
# Start command as argument to `start-nginx` script
bin/start-nginx $COMMAND
else
# Start command without nginx (development and debugging)
$COMMAND

Replying to a Twitter conversation with @johnjoseph_code:


Our number one concern is helping our developers get better performance out of their app. Period.

We are recommending Unicorn so that developers will use more RAM. Most Rails apps that I examined were using thin - because we had recommended it in the past - and were not using anywhere near the full capacity of their dynos in terms of memory or CPU. Because of Unicorn's forking process model, it is often a trivial switch for an application to make that provides a near instant boost in performance for them by actually using all the RAM they have requested. With 2X dynos, developers can verically scale pretty well, generally fitting 4-8 unicorn workers on a dyno (or more if you set extremely tight conditions with https://github.com/kzk/unicorn-worker-killer).

@dominic
dominic / gist:1873044
Created February 21, 2012 02:14
MacRuby App Store manual deployment steps

Submitting to the App Store

First, install Developer certs from Apple's Developer portal

To Build the Application:

  • Select "Your App" from your Scheme menu, NOT "Deployment"
  • Select Product > Archive to build for Release
  • Once completed, the Organizer window will open
  • Select your recent build and press the "Validate" button - make sure this passes!
@dominic
dominic / source-404.html
Created October 12, 2011 03:22
Octopress 404 default
---
layout: page
title: "404"
sidebar: false
comments: false
sharing: false
---
Sorry, I couldn't find what you were looking for.
@dominic
dominic / request.rb
Created June 16, 2011 19:28
Briquette App Request Handling
# Request.rb
# briquette
#
# Created by Dominic Dagradi on 11/13/10.
# Copyright 2010 Bearded. All rights reserved.
require 'rubygems'
require 'crack'
require 'TextHelper'