Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am sujal on github.
  • I am sujal (https://keybase.io/sujal) on keybase.
  • I have a public key ASABqfxEvIEaOt1XTuC7ePcfERNgdznARTuzDOhzWIdvJgo

To claim this, I am signing this object:

@sujal
sujal / update-production.sh
Last active December 20, 2015 13:17
The script I use to push code live
#!/bin/bash
MACHINE_NAME=$1
if [ -z "$MACHINE_NAME" ]; then
echo "MACHINE NAME required as command line argument"
exit 1
fi
eval "$(docker-machine env $MACHINE_NAME)"
@sujal
sujal / Dockerfile
Last active December 20, 2015 13:17
The dockerfile used to build the production image
FROM wordpress:latest
COPY wordpress/wp-content/themes/ /usr/src/wordpress/wp-content/themes/
RUN chown -R www-data:www-data /usr/src/wordpress/wp-content/themes/*
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -q -q && \
apt-get install apt-utils --yes --force-yes && \
@sujal
sujal / common.yml
Last active December 20, 2015 13:16
This is my docker-compose file for local development
dataContainer:
image: tianon/true
volumes:
- /var/www/html
- /var/lib/mysql
- /sslcerts:/sslcerts
web:
build: .
mysql:
image: mysql:5.7
@sujal
sujal / TwitterURLOutput.js
Created July 24, 2011 04:13
JSON output of a tweet containing a URL from twitter
{
"in_reply_to_status_id_str": null,
"coordinates": null,
"in_reply_to_screen_name": null,
"in_reply_to_status_id": null,
"in_reply_to_user_id_str": null,
"contributors": null,
"user": {
"profile_sidebar_border_color": "181A1E",
"protected": false,
@sujal
sujal / gist:1100972
Created July 23, 2011 03:41
Creating arbitrarily-colored icons from a black-with-alpha master image (iOS)
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
@sujal
sujal / OCZeroEdgeTextView.m
Created April 7, 2011 22:02
Seeing this in a crash log (actually a hoptoad error report)
// this is all that the zeroedgetextview does
@implementation OCZeroEdgeTextView
- (UIEdgeInsets)contentInset { return UIEdgeInsetsZero; }
@end
@sujal
sujal / Choose_Lunch.rb
Created January 28, 2011 03:19
How I choose lunch at the ESPN cafeteria each day
require 'lunch_choice_observation'
LUNCH_CHOICES = ["Pizza", "Salad"]
SIDE_CHOICES = ["Clif Bar", "Popchips", "Glenny's Soy Crisps"]
DRINK_CHOICES = ["Diet Pepsi", "Diet Dr. Pepper", "VitaminWater Zero", "Sprite Zero",
"Water", "Water", "Water", "Water", "Water", "Water"]
def choose_lunch
choices = Array.new
@sujal
sujal / bash_profile.sh
Created January 15, 2011 02:49
Bash Git Completion section in jasoncodes or my dotfiles
# add git status if available
if which git > /dev/null
then
GIT_COMPLETION_PATH="$(dirname $(realpath "$(which git)"))/../etc/bash_completion.d/git-completion.bash"
fi
if [ ! -f "$GIT_COMPLETION_PATH" ]
then
GIT_COMPLETION_PATH=$(first_file_match -f \
"/usr/local/git/contrib/completion/git-completion.bash" \
"/opt/local/share/doc/git-core/contrib/completion/git-completion.bash" \