Skip to content

Instantly share code, notes, and snippets.

```sh
pip install -r requirements.txt
python mccmnc.py
```
{
"IAB1": "Arts & Entertainment",
"IAB1-1": "Books & Literature",
"IAB1-2": "Celebrity Fan/Gossip",
"IAB1-3": "Fine Art",
"IAB1-4": "Humor",
"IAB1-5": "Movies",
"IAB1-6": "Music",
"IAB1-7": "Television",
"IAB2": "Automotive",
@edrabc
edrabc / Gruntfile.js
Last active January 1, 2016 20:39
Grunt template to build JS modules, with pretty-printing and code static validation.
module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-git-changedfiles");
grunt.loadNpmTasks("grunt-jsbeautifier");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
code: ["Gruntfile.js", "src/**/*.js", "lib/**/*.js", "test/**/*.js"],
// Check https://github.com/einars/js-beautify#options
@edrabc
edrabc / git-prune-branches.sh
Last active December 30, 2015 08:28
Prune already merged branches
# Based on http://stackoverflow.com/a/6127884/722997
# Remote already merged local branches
git branch --merged | grep -v "\*" | grep -v develop | grep -v master | xargs -n 1 git branch -d
# Remote already merged remote branches
git branch --remote --merged | grep -v release | grep -v develop | grep -v master | sed s/origin\\///g | xargs -n 1 git push --delete origin
@edrabc
edrabc / .gitignore
Last active December 26, 2015 10:49
Well known common git ignore rules...
# Numerous temporary extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*.bck
#!/usr/bin/env python
""" Test HTTP Server
This script starts a http server that will respond to HTTP requests
with a predefined response.
Usage:
./http_server.py --port=8080 --code=404 --content="Page not Found"
@edrabc
edrabc / aspectj.gradle
Last active December 17, 2015 18:09
AspectJ support for Gradle 1.5+ (extracted from https://github.com/ultraq/gradle-support) Version from http://www.breskeby.com/2010/02/using-gradle-with-aspectj, does not work straight off, so just copying here version from https://raw.github.com/ultraq/gradle-support/master/aspectj.gradle, in order to adapt it to my needs and freeze the current…
configurations {
ajc
aspects
ajInpath
}
dependencies {
ajc 'org.aspectj:aspectjtools:1.7.2'
compile 'org.aspectj:aspectjrt:1.7.2'
}
@edrabc
edrabc / gist:5236611
Created March 25, 2013 11:47
pyshould test-case to handle exceptions using Python 2.6
import unittest
from pyshould import should
class ExceptionTestCase(unittest.TestCase):
""" Simple tests for exception assertions """
def test_expect_throw_non_empty_constructor_exception(self):
with should.throw(NonEmptyConstructorException):
raise NonEmptyConstructorException([])