Skip to content

Instantly share code, notes, and snippets.

View afgomez's full-sized avatar
♻️

Alejandro Fernández Gómez afgomez

♻️
View GitHub Profile
@afgomez
afgomez / webpack3.config.js
Created May 19, 2018 09:16
Webpack 3 & 4 config equivalents
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
one: './src/one.js',
two: './src/two.js',
three: './src/three.js',
},
output: {
@afgomez
afgomez / lets.sh
Last active February 12, 2017 08:24
Simple productivity booster
#!/bin/bash
# lets. A productivity booster
# Based on ideas from https://gist.github.com/605292
#
# Create a /etc/hosts.work with a list of sites you wanna block and execute
#
# $ sudo lets work
#
# When you finish your hard work, unblock the sites writing

Keybase proof

I hereby claim:

  • I am afgomez on github.
  • I am afgomez (https://keybase.io/afgomez) on keybase.
  • I have a public key ASCjWNVip-MxWrKQiDaldwKy0lni4ExvYmZSlv51veTG4Qo

To claim this, I am signing this object:

@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();
*/
diff --git a/SublimeLinter.py b/SublimeLinter.py
index 1e4e670..529b5f0 100644
--- a/SublimeLinter.py
+++ b/SublimeLinter.py
@@ -39,7 +39,7 @@ DELAYS = (
# "alpha", "bright", "dark", "hard" and "simple"
MARK_THEMES = ('alpha', 'bright', 'dark', 'hard', 'simple')
# The path to the built-in gutter mark themes
-MARK_THEMES_PATH = os.path.join('..', 'SublimeLinter', 'gutter_mark_themes')
+MARK_THEMES_PATH = os.path.join('Packages', 'SublimeLinter', 'gutter_mark_themes')
@afgomez
afgomez / random_spec.rb
Created June 6, 2013 16:18
Easy way to allow remote inspection in poltergeist/capybara
# spec/features/random_spec.rb
require 'spec_helper'
describe "Random feature" do
it "Does't have debugging" do
# ...
# page.driver.debug
end
inputs.each(function(){
var address = $(this),
form = address.closest('form'),
hiddenCoords = form.find('#coordinates');
// Namespaceamos el evento para quitarlo más adelante
form.on('submit.getAddress', function(e){
// Paramos el evento por defecto
e.preventDefault();
@afgomez
afgomez / jquery.last_tweet.js
Last active December 10, 2015 04:28
Get the last tweet from any user
/**
* jQuery.lastTweet
* ----------------
*
* Fetch the last tweet from the specified user
*
* Usage:
*
* $('#container').lastTweet('username');
*
@afgomez
afgomez / sqlize.rb
Created February 27, 2012 12:14
Convert a hash into a valid key=value SQL string
# gives a valid key=value SQL string for using in "INSERT INTO `table` SET" sentences
# >> "INSERT INTO `table_name` SET #{sqlize(Model.find(id).attributes)};"
# returns
# => "INSERT INTO `table_name` SET `attr1`=value1,`attr2`=value2..."
# Handles different datatypes
def sqlize hash
hash.map do |k,v|
v = case v
when Time
@afgomez
afgomez / jqueyr.filterator.js
Created February 22, 2012 11:29
jQuery filterator
/**
* jQuery filterator
*
* Filter collections of elements using javascript.
* Uses HTML5 data attributes to get the filter values.
*
* Usage:
*
* $('element_containing_filters').filterator( { target: filter_criteria, items: selector_or_jquery_collection_to_filter } );
*