Skip to content

Instantly share code, notes, and snippets.

View davoclavo's full-sized avatar
🎯
Focusing

Davo davoclavo

🎯
Focusing
View GitHub Profile
@davoclavo
davoclavo / inverted_internet.py
Last active November 22, 2021 15:50
Inverted internet for mitmproxy
#!/usr/bin/env python
"""
Inject inverting css
Usage:
inverted_internet
"""
from libmproxy import controller, proxy
import os
import sys
@davoclavo
davoclavo / vine.py
Created July 26, 2013 21:28
Vine API from Vino with added methods
# coding: utf-8
import json
import logging
import requests
BASE_URL = "https://api.vineapp.com/"
class VineError(Exception):
@davoclavo
davoclavo / homejoy.md
Created March 17, 2013 20:28
Homejoy bug

In your updatePrice() function you get the number of hours out of the dropdown menu, but the maximum possible number of hours is 12.5. If you select several extras and a really large house, the number of hours becomes larger than the maximum possible at the dropdown, so it renders a wrong price.

This is the line that is causing trouble, you can either add more options to the dropdown or create a variable that stores the number of hours and it can either be changed through a dropdown change, or a change in cleaning service options (size, extras, etc):

var hours = parseFloat($("#num_hours_dropdown :selected").val());

Image

@davoclavo
davoclavo / chartio.md
Last active December 14, 2015 22:59
Chart.io link bug

When you are navigating a specific job page, the job links on the sidebar are broken, because the protocol part is url encoded, the browser (in my case, Chrome) interprets them as relative links. The links are hrefed as this: https%3A//chartio.com/jobs/ui-developer

So, don't escape html characters in the protocol part of the link.

Cheers and beers!

Bug #1:

If the filename is too big, it gets on top of the "N file" link icon, which looks nasty. bug1

And maybe you will say:

no one will ever write a name that long, GOSH!

well, it doesn't only looks weird, but it is the source of another bug...

@davoclavo
davoclavo / dataURItoBlob.js
Last active May 26, 2023 14:45
Convert dataURI to Blob so large images do not crash the browser. Based on: http://stackoverflow.com/questions/10412299 and http://stackoverflow.com/questions/6850276
/*
The MIT License (MIT)
Copyright (c) 2016 David Gomez-Urquiza
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
@davoclavo
davoclavo / print.css
Created December 24, 2012 16:43
letter paper printing css
@media print {
.pagina {
border: 1px solid black;
width: 763px;
height: 988px;
background-color: lightgray;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@davoclavo
davoclavo / getJpath.js
Created December 18, 2012 22:41
Get a property from an object using jpath notation (I don't even know if that notation exists, but it is like 'object.property1.property2'). I use it to get properties of unknown objects that may or may not have a property, and they raise an exception.
getJpath = function(object, path){
var segments = path.split('.');
var first = segments.shift(); // and it removes it from the array
if( object[first] ) {
if( segments.length > 0 ) {
return getJpath(object[first], segments.join('.'));
} else {
return object[first];
}
} else {
@davoclavo
davoclavo / pizza-time.md
Created December 13, 2012 02:00
A nice pizza recipe!

Pizza Time!

6 1/2 cups bread flour 2 teaspoons yeast 3 1/4 cup cold water 6 Tablespoons olive oil 2 teaspoons salt 3 teaspoons sugar Mix yeast, sugar and salt together with a cup of water. Put 5 cups of flour in mixer (or bowl if your doing it old school). Add yeast mixture, olive oil and water. Start mixing. Slowly add remaining flour until you get a moist ball of dough. Don't put to much flour in because the dough will get too dry.

Kneed dough for around 10 minutes. I just leave it in the mixer and let the dough hook do the trick. Then cut the dough ball into 8 individual balls. I then coat each ball with more olive oil, put them in a bowl and let them rise over night in the fridge.

Take them out of the fridge an hour prior to cooking. Preheat your oven with pizza stone for an hour, and set the temp as high as it will go. Pizzas take 3 or 4 minutes to cook depending on toppings.

@davoclavo
davoclavo / Soda Dark.sublime-theme
Created December 12, 2012 15:39
highlight_modified_tabs orange
{
"class": "tab_label",
"settings": ["highlight_modified_tabs"],
"parents": [{"class": "tab_control", "attributes": ["dirty"]}],
"fg": [255, 161, 52]
}