Skip to content

Instantly share code, notes, and snippets.

🐕

Igor Escobar igorescobar

🐕
Block or report user

Report or block igorescobar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@igorescobar
igorescobar / imageboss-url.js
Last active Oct 27, 2019
Generating ImageBoss URLs with JavaScript
View imageboss-url.js
function mountImageBossUrl(src, { operation, cover_mode, width, height, options }) {
var serviceUrl = 'https://img.imageboss.me';
var template = '/:operation/:options/';
if (operation === 'cover') {
template = '/:operation::cover_mode/:widthx:height/:options/';
} else if (operation === 'width') {
template = '/:operation/:width/:options/';
} else if (operation === 'height') {
template = '/:operation/:height/:options/';
@igorescobar
igorescobar / 01_sync_postgres_sequences.sql
Last active Jan 10, 2018
Syncing Postgres Sequences for All Tables
View 01_sync_postgres_sequences.sql
-- https://wiki.postgresql.org/wiki/Fixing_Sequences
SELECT 'SELECT SETVAL(' ||
quote_literal(quote_ident(PGT.schemaname) || '.' || quote_ident(S.relname)) ||
', COALESCE(MAX(' ||quote_ident(C.attname)|| '), 1) ) FROM ' ||
quote_ident(PGT.schemaname)|| '.'||quote_ident(T.relname)|| ';'
FROM pg_class AS S,
pg_depend AS D,
pg_class AS T,
pg_attribute AS C,
pg_tables AS PGT
@igorescobar
igorescobar / delete_git_old_tags.rb
Created Dec 12, 2017
A utility for deleting old git tags
View delete_git_old_tags.rb
# CUT_OFF_DATE needs to be of YYYY-MM-DD format
CUT_OFF_DATE = "2016-06-30"
def get_old_tags(cut_off_date)
`git log --tags --simplify-by-decoration --pretty="format:%ai %d"`
.split("\n")
.each_with_object([]) do |line, old_tags|
if line.include?("tag: ")
date = line[0..9]
tags = line[28..-2].gsub(",", "").concat(" ").scan(/tag: (.*?) /).flatten
@igorescobar
igorescobar / clean-junk.sh
Last active Nov 21, 2017
Clean junk files from vendor/bundle directory
View clean-junk.sh
#!/usr/bin/env bash
find ./vendor/bundle \( -name '__tests__' -o \
-name "*.md" -o \
-name "*LICENSE*" -o \
-name "*.ts" -o \
-name "*.jst" -o \
-name "*.coffee" -o \
-name "*.rdoc" -o \
-name "example" -o \
-name "examples" -o \
@igorescobar
igorescobar / ssh_config.sh
Created Mar 3, 2017
Connect to a PRIVATE machine through a PUBLIC machine.
View ssh_config.sh
# put this in your ~/.ssh/config
Host public.host
HostName $ip
User $username
IdentityFile $identity_file_path
Host private.host
ProxyCommand ssh -q -W $private_ip:$private_local_port public.host
User $username
IdentityFile $identity_file_path
View Preferences.sublime-settings
{
"ensure_newline_at_eof_on_save": true,
"font_size": 14,
"highlight_line": true,
"ignored_packages": [ "Vintage" ],
"rulers": [100],
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true
View multi-line-css-truncate-ellipsis.scss
// e.g: @include truncate(.875em, 1.4, 10)
@mixin truncate($font-size, $line-height, $lines-to-show) {
display: block; // Fallback for non-webkit
display: -webkit-box;
max-width: 400px;
height: $font-size*$line-height*$lines-to-show; // Fallback for non-webkit
font-size: $font-size;
line-height: $line-height;
-webkit-line-clamp: $lines-to-show;
@igorescobar
igorescobar / github-expand-comments.js
Last active Aug 23, 2016
Expand Github Pull Request Comment Bookmark
View github-expand-comments.js
// add this as a bookbark on your browser
javascript:Array.from(document.getElementsByClassName('outdated-diff-comment-container')).forEach(l => l.classList.add('open'));
@igorescobar
igorescobar / fix-house-search.md
Last active Jun 17, 2016
Feature Request: Search for a new house using its approximation of a POI like a subway, mall or something like that.
View fix-house-search.md

Feature Request: Search for a new house using its approximation of a POI like a subway, mall or something like that.

Here is how you can achieve it:

  1. When your user are adding a new house for sale/rent they also provide its address.
  2. With this address you are able to convert it to a latitute,longitude (x,y).
  3. With this x,y you are able to use a service like Google Places API and store on your database the proximity of a lot of useful POIs from the house itself.
  4. Now that you have all those nearby POIs stored and its distances from the provided address, you are able to provide a freaking awesome search for your users.
  5. Now you can for example search for a house or appartment, for rent, in Lisbon, which is 1-2km near of a subway or a train station.
  6. How? With postgres you can use extensions like cube or earthdistance. Or with a no-sql solution using Geospatial index (2d).
@igorescobar
igorescobar / docker-compose.yml
Last active May 27, 2016
Two neo4j containers on the same local network without sharing data.
View docker-compose.yml
# based on @spacecowboy at https://github.com/neo4j/docker-neo4j/issues/34
version: '2'
services:
neo4j:
image: neo4j
ports:
- "7474:7474"
networks:
- basic-lan
You can’t perform that action at this time.