Skip to content

Instantly share code, notes, and snippets.

@pablasso
pablasso / chromedriver.rb
Last active March 27, 2019 22:01
Chromedriver cask for 2.37
cask 'chromedriver' do
version '2.37'
sha256 'a1c4699cf12d51a5284971ba5ca2d8e354e422acd5151c920c5105339f4a5d29'
# chromedriver.storage.googleapis.com was verified as official when first introduced to the cask
url "https://chromedriver.storage.googleapis.com/2.37/chromedriver_mac64.zip"
name 'ChromeDriver'
homepage 'https://sites.google.com/a/chromium.org/chromedriver/home'
binary 'chromedriver'
04c224330e65f99e8bb9f6ff43f79a6f5b55afb05d2fd4fca18e405282e49a87601145c595bed27869136aa5630e6f50381d6fbb2297bd80e47b296f28342b38d8
@pablasso
pablasso / how-to-write-an-spec.md
Last active January 13, 2022 09:18
How to write an spec

How to write a Specification

So why should we write specs? you may be asking.

Why won't people write specs? People claim that it's because they're saving time by skipping the spec-writing phase. They act as if spec-writing was a luxury reserved for NASA space shuttle engineers, or people who work for giant, established insurance companies. Balderdash. First of all, failing to write a spec is the single biggest unnecessary risk you take in a software project. It's as stupid as setting off to cross the Mojave desert with just the clothes on your back, hoping to "wing it." Programmers and software engineers who dive into code without writing a spec tend to think they're cool gunslingers, shooting from the hip. They're not. They are terribly unproductive. They write bad code and produce shoddy software, and they threaten their projects by taking giant risks which are completely uncalled for.

*– Joel Spolsky on [Painless Functional Specifications](http://www.joelonsoftware.com/articles/fog0000000036

@pablasso
pablasso / test_transaction.py
Last active February 29, 2016 23:37
test_transaction.py
from django.core.management.base import BaseCommand
from django.db import transaction
class Command(BaseCommand):
args = ''
help = ''
def handle(self, **options):
for i in range(0, 5):
@pablasso
pablasso / runner.py
Created February 17, 2016 10:18
Queue Runner Proof of Concept
# flake8: noqa
from datetime import datetime
import time
class QueueRunnerTimeoutException(Exception):
pass
#!/bin/bash
#
# Convert the (broken) avi files saved by the hubsan x4 H107D remote.
#
# This gstreamer pipeline reindexes the avi file, crops the broken parts of the
# image to the right and left and fixes the aspect ratio. The new files are
# saved into the 'fixed' folder.
#
# <chris@1337.af>
@pablasso
pablasso / model_diff_mixin.py
Last active August 29, 2015 14:09
This is from this thread: http://stackoverflow.com/a/13842223/19329 patched with the suggested fixes to avoid infinite loops while using objects.raw() or objects.only()
from django.forms.models import model_to_dict
class ModelDiffMixin(object):
"""
A model mixin that tracks model fields' values and provide some useful api
to know what fields have been changed.
"""
def __init__(self, *args, **kwargs):
@pablasso
pablasso / FizzBuzz1.js
Last active October 28, 2015 18:38
CodeGDL Extra Exercises
for (var i=1; i<=100; i++) {
if (i % 3 === 0) {
console.log('Fizz');
}
else if (i % 5 === 0) {
console.log('Buzz');
}
else {
console.log(i);
}

Keybase proof

I hereby claim:

  • I am pablasso on github.
  • I am pablasso (https://keybase.io/pablasso) on keybase.
  • I have a public key whose fingerprint is 5732 9BB1 4218 0189 060A 4C7A BFE1 884D EB5A 5310

To claim this, I am signing this object: