Skip to content

Instantly share code, notes, and snippets.

Aziz M. Bookwala azizmb

Block or report user

Report or block azizmb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@azizmb
azizmb / installing_pil.md
Last active Aug 29, 2015
PIL dependencies
View installing_pil.md

Installing libs and fixing lib links

build=`uname --hardware-platform`
apt-get install python-dev libjpeg62 libjpeg-dev libpng12-0 libpng-dev libfreetype6-dev
ln -s /usr/lib/${build}-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/${build}-linux-gnu/libz.so /usr/lib
@azizmb
azizmb / album_scrape.py
Created Feb 24, 2012
Script to download all photos from an album in imgur
View album_scrape.py
from BeautifulSoup import BeautifulSoup
import requests
import os
album_url = "http://imgur.com/a/TYfWa/all/hot/day/page/%d?scrolled"
pages = 3
directory = "heroes"
posts_list = []
@azizmb
azizmb / bootstrap_helper.rb
Created Apr 24, 2012 — forked from thatfunkymunki/application_helper.rb
Make will_paginate generate HTML that bootstrap.less will render nicely, fixed for will_paginate 3.0.2
View bootstrap_helper.rb
def bootstrap_paginate(pages, options={})
options.reverse_merge!(
:class => 'pagination',
:renderer => BootstrapLinkRenderer,
:previous_label => '←'.html_safe,
:next_label => '→'.html_safe
)
will_paginate(pages, options)
end
@azizmb
azizmb / bootstrap.validator.overrides.js
Created Apr 25, 2012
Bootstrap Validator Overrides
View bootstrap.validator.overrides.js
$.extend($.validator.messages, {
required: "can't be blank",
remote: 'needs to get fixed',
email: 'is an invalid email address',
url: 'is not a valid URL',
date: 'is not a valid date',
dateISO: 'is not a valid date (ISO)',
number: 'is not a valid number',
digits: 'needs to be digits',
creditcard: 'is not a valid credit card number',
@azizmb
azizmb / _notification.html.haml
Created Apr 25, 2012
Bootstrap flash messages
View _notification.html.haml
- flash.each do |type, message|
.alert.alert-block{:class => "alert-#{bootstrap_alert_type(type)}" }
%h4.alert-heading #{ bootstrap_alert_type(type).titleize }!
= message
@azizmb
azizmb / carmen_country_input.rb
Created May 18, 2012
Carmen Country input field for SimpleForm
View carmen_country_input.rb
class CarmenCountryInput < SimpleForm::Inputs::PriorityInput
def input
@builder.send(:"country_select", attribute_name, input_options, input_html_options)
end
end
View 0_instructions.txt
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
filesystem will be different but this guide will get you working with it
while we wait for all that to finalize.
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist.
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention
View fb_init.html
<div id="fb-root"></div>
<script>
var fbAppId = '< APP ID >';
(function(){
var fbInitFuncs = [];
var fbInitialized = false;
window.fbAsyncInit = function() {
@azizmb
azizmb / appname1-urls.py
Created Aug 29, 2012
A pattern for implementing RESTfull nested resources in Django
View appname1-urls.py
from django.conf.urls import patterns, url
from django.contrib.contenttypes.models import ContentType
from appname1.views import PostListView, PostDetailView, \
PostCreateView, PostDeleteView, PostUpdateView
from appname2.views import CommentListView,\
CommentDetailView, CommentCreateView, CommentDeleteView, \
CommentUpdateView
from models import Post
@azizmb
azizmb / mandrill-sync.py
Created Nov 22, 2015
Simple script to sync templates across two mandrill accounts.
View mandrill-sync.py
import optparse
from mandrill import Mandrill
from mandrill import UnknownTemplateError
def sync_templates(source_key, destination_key, update_existing=True, dry_run=False):
def perform_action(action):
'''Simple wrapper to skip actaully doing anything if dry run is enabled.
You can’t perform that action at this time.