Skip to content

Instantly share code, notes, and snippets.

View iduuck's full-sized avatar
🎯
Focusing

nick iduuck

🎯
Focusing
View GitHub Profile
@iduuck
iduuck / reject_post.rb
Created May 7, 2016 21:10
How to reject a post based on some attributes
# We are using the default ruby http client for the request to the
# shortened url, because otherwise a Gemfile or something different
# would be necessary
require 'net/http'
# I am using an example url from webdesignshare.com (with url shortener)
uri = URI('http://url.tusiad.org/make-people-stay-website')
res = Net::HTTP.get_response(uri)
@iduuck
iduuck / gist:58a4e663a5ecace0ec45
Created January 23, 2015 21:43
config.sublime-settings
{
"auto_indent": true,
"binary_file_patterns":
[
"bower_components/*",
"node_packages/*",
"public/bower_components/*",
"dist/*",
"*.jpg",
"*.png",
@iduuck
iduuck / gist:8b91138c070502f21743
Created June 24, 2014 05:42
⌘ + Enter to send an email
# ~/.osx — https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9"
@iduuck
iduuck / import-pg-mongodb.rb
Last active August 29, 2015 13:56
Because I didn't found a simple solution for importing the database from Heroku (Postgresql) on my localhost (Mongoid). Import your database on localhost or online with this script (from Heroku)
## Requirements:
## - Ruby on Rails
## - Existing Heroku Application
## - HTTParty
# Get the json content of the
# backup and parse it
url = 'https://dataclips.heroku.com/xxx.json'
json = HTTParty.get(url)