Skip to content

Instantly share code, notes, and snippets.

View hassanshamim's full-sized avatar

Hassan Shamim hassanshamim

  • Philadelphia, PA
View GitHub Profile
def top10(str)
word_dict = Hash.new{|hash, key| hash[key] = 0 }
str.split.each{ |word| word_dict[word] += 1 }
word_dict.to_a.sort{|a, b| b.last <=> a.last }.take(10).map(&:first) #ugly ugly
end
@hassanshamim
hassanshamim / supported_currencies
Last active January 2, 2016 00:19
dutycalc's currency xml response
'<?xml version="1.0" encoding="utf-8"?>\n<currencies><currency code="EUR">Euro </currency>\n<currency code="GBP">£ Sterling</currency>\n<currency code="USD">US Dollar </currency>\n<currency code="AUD">Aus
tralian Dollar </currency>\n<currency code="BSD">Bahamian Dollar</currency>\n<currency code="PAB">Balboa</currency>\n<currency code="BDT">Bangladeshi taka</currency>\n<currency code="BBD">Barbadian Dollar
</currency>\n<currency code="BZD">Belize Dollar</currency>\n<currency code="BMD">Bermudian Dollar</currency>\n<currency code="BWP">Botswana Pula</currency>\n<currency code="BRL">Brazilian Real </currency>
\n<currency code="BGN">Bulgarian Lev</currency>\n<currency code="CAD">Canadian Dollar</currency>\n<currency code="KYD">Cayman Islands Dollar</currency>\n<currency code="CNY">Chinese Yuan</currency>\n<curr
ency code="CRC">Costa Rican colón</currency>\n<currency code="CZK">Czech Koruna</currency>\n<currency code="DKK">Danish Krone</currency>\n<currency code="DOP">Dominican peso</currency>\n<currency code="X
@hassanshamim
hassanshamim / 0_reuse_code.js
Created January 20, 2014 21:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hassanshamim
hassanshamim / javascript_resources.md
Created January 20, 2014 21:30 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@hassanshamim
hassanshamim / rails_resources.md
Created January 20, 2014 21:30 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@hassanshamim
hassanshamim / python_resources.md
Created January 20, 2014 21:30 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@hassanshamim
hassanshamim / notebook play
Created February 23, 2014 23:03
notebook play
{
"metadata": {
"name": "notebook play"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
http://pcottle.github.io/learnGitBranching/
http://rogerdudler.github.io/git-guide/
http://think-like-a-git.net/
http://gitimmersion.com/
http://gitref.org/
http://git-scm.com/documentation
@hassanshamim
hassanshamim / GetLucky
Last active August 29, 2015 14:08
pip install GetLucky
avendesora•~» pip install GetLucky [14:52:49]
Downloading/unpacking GetLucky
Downloading GetLucky-1.2.7.tar.gz (44kB): 44kB downloaded
Running setup.py egg_info for package GetLucky
Downloading/unpacking requests>=2.2.1 (from GetLucky)
Downloading requests-2.4.3.tar.gz (438kB): 438kB downloaded
Running setup.py egg_info for package requests
Downloading/unpacking beautifulsoup4>=4.3.2 (from GetLucky)
@hassanshamim
hassanshamim / zombip.py
Last active October 11, 2016 00:29
zoombit or w/e it's called
# -*- coding: utf-8 -*-
"""
>>> process([[1, 2, 4], [5, 1, 4], [1, 2, 3]], (0,2), 4)
[[-1, -1, -1], [5, -1, -1], [-1, -1, -1]]
>>> process([[1, 3, 2], [1, 1, 4], [0, 4, 3]],(0,2), 3)
[[-1, -1, -1], [-1, -1, 4], [-1, 4, 3]]
>>> process([[1, 3, 2], [1, 1, 4], [0, 4, 3]],(0,0), 2)