Skip to content

Instantly share code, notes, and snippets.

View carloscabo's full-sized avatar
🏠
Working 100% remotely since 2018

Carlos Cabo carloscabo

🏠
Working 100% remotely since 2018
View GitHub Profile
@stevelacey
stevelacey / PHP: Simple HTML Table Scrape
Created October 29, 2010 21:46
PHP: Simple HTML Table Scrape
<?php
$doc = new DOMDocument();
// It's rare you'll have valid XHTML, suppress any errors- it'll do its best.
@$doc->loadhtml($string);
$xpath = new DOMXPath($doc);
// Modify the XPath query to match the content
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active June 19, 2024 13:39
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
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:
@rsierra
rsierra / rawclone_bundler.rb
Last active September 28, 2015 06:38
Script para generar el Gemfile de bundler a partir de un 'gem list'
#!/usr/bin/env ruby
# So you want to start developing an already "woking" project. No
# bundle, config.gem's not present or messing up dependencies. Fear
# not!
# Do a "gem list" wherever the project is already working
# (production?, some colleage machine?). Make a file with this format:
#
# chronic (0.2.3)
# colored (1.1)
@Rafe
Rafe / gist:3102414
Created July 13, 2012 02:59
AWK cheatsheet
HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008
Compiled by Eric Pement - eric [at] pement.org version 0.27
Latest version of this file (in English) is usually at:
http://www.pement.org/awk/awk1line.txt
This file will also be available in other languages:
Chinese - http://ximix.org/translation/awk1line_zh-CN.txt
USAGE:
@stuaxo
stuaxo / cairo_pyglet.py
Last active March 14, 2023 15:07
Render cairo on pyglet... modified from http://ethanmiller.name/
# Draw cairo in a pyglet window - without an intermediate image file.
import ctypes
#import cairocffi as cairo # example will work with cairocffi instead too
import cairo
import time
from pyglet import app, clock, font, gl, image, window
WIDTH, HEIGHT = 400, 400
@dciccale
dciccale / README.md
Last active October 22, 2021 21:52
Tiny Cross-browser DOM ready function in 111 bytes of JavaScript

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

/*
Responsive Pseudo-grid
We define here the cols width that will be asigned to the containers.
Include this mixins in the corresponding semantic container this way.
.container {
@include col-50(%3, %3);
}
/* Send a form with a link with data-form="#form_id"
/ You can define params="name,value name,value"
/ All params will be append to the form as hidden inputs before send it
*/
$('body').on('click', '[data-form]', function(e) {
e.preventDefault();
var el = $(this),
form = $(el.data('form')),
params;
@TomByrne
TomByrne / MultiExporter.jsx
Last active June 14, 2024 09:48
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@afgomez
afgomez / ios7bottom.js
Last active January 1, 2016 10:29
jQuery plugin to ensure the bottom toolbars are always visible in iOS7
/**
* ios7bottom
*
* Listen to changes in safari window size to ensure the position:fixed
* elements are always visible.
*
* Usage
*
* $('#toolbar').ios7bottom();
*/