Skip to content

Instantly share code, notes, and snippets.

require "net/http"
require "uri"
def get_cpa(calle, altura)
url = "http://www3.correoargentino.com.ar/scriptsN/cpa/cpa_calle.idc"
res = Net::HTTP.post_form(URI.parse(url), {
:codloca => "5001",
:pnc => calle,
:alt => altura
})
@WizardOfOgz
WizardOfOgz / gist:1012107
Created June 7, 2011 12:13
Save Base64-encoded images with Paperclip
class Avatar < ActiveRecord::Base
attr_accessor :content_type, :original_filename, :image_data
before_save :decode_base64_image
has_attached_file :image,
PAPERCLIP_CONFIG.merge(
:styles => {
:thumb => '32x32#',
:medium => '64x64#',
@ceneon
ceneon / gist:1081999
Created July 14, 2011 05:44
Fix Gmail "Preview" Theme with "Chat in Right Column" Lab.
// Styles needed to fix layout
.pp{ margin-left: 0px !important; margin-right:0px !important;}
.q0CeU{ margin-right:0px !important}
// Execute this in the inspector window or the address bar, or bookmark it if you can
javascript:i=document.getElementById("canvas_frame").contentWindow.document;j=i.getElementsByClassName("T0 pp");for(k=0;k<j.length;k++)if(j.item(k).getElementsByClassName("pw").item(0).innerHTML=="Chat")j.item(k).style.margin='0';i.getElementsByClassName("nH q0CeU z").item(0).style.marginRight='0';void 0
@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@leodutra
leodutra / removeComments.js
Last active March 1, 2021 04:08
Remove HTML/JavaScript Comments
function removeComments(html) {
return (''+html)
.replace/*HTMLComments*/(/<!-[\S\s]*?-->/gm, '')
.replace/*JSBlockComments*/(/\/\*[\S\s]*?\*\//gm,'')
.replace/*JSLineComments*/(/^.*?\/\/.*/gm, '$1') // FIXME
}
@joakin
joakin / git-find-me-the-fucking-deleted-file.sh
Last active June 30, 2024 13:10
finding a deleted file in a git repository
# If you don't remember the exact path/name, search the log for deleted files
git log --diff-filter=D --summary | grep delete
# Find the file you want to get from the ouput, and use the path
# Find the commits that involved that path
git log --all -- some/path/to/deleted.file
# Bring the file back to life to the current repo (sha commit of parent of commit that deleted)
git checkout shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file
@fernandoaleman
fernandoaleman / fix-libv8-mac.txt
Created May 5, 2016 15:14
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
@cristianrasch
cristianrasch / optimize-images.rb
Created November 25, 2016 18:59
Little image optimization script
#!/usr/bin/env ruby
# Debian pkg dependencies:
# - pngcrush
# - libjpeg-progs
# - imagemagick
# Usage: optimize-images graphic1.png photo1.jpeg bash-glob-exp1
require "fileutils"
@STiXzoOR
STiXzoOR / TeamViewer-15-id-changer-for-mac.py
Last active June 18, 2024 15:47 — forked from 0x2a94b5/TeamViewer-15-id-changer-for-mac.py
Teamviewer 15 ID Changer for macOS (Python 3)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# System: macOS 12+
# Version: TeamViewer v15.x.x
# Python: 3.x.x
# Command: sudo python TeamViewer-15-id-changer.py
#
import os