Skip to content

Instantly share code, notes, and snippets.

View p1nox's full-sized avatar

Raul Pino p1nox

View GitHub Profile
@p1nox
p1nox / ccopter.rake
Last active December 12, 2015 09:58
Copycopter Offline: using copycopter only on development environment
namespace :ccopter do
desc "Split copycopter yml file"
task :split_ccopter_file => :environment do
CCOPTER_FILE = "#{Rails.root}/config/locales/copycopter.yml"
created_files = 0
if File.exists?(CCOPTER_FILE)
CCOPTER = YAML.load_file(File.open(CCOPTER_FILE))
@p1nox
p1nox / postgresql_configuration_on_ubuntu_for_rails.md
Last active July 20, 2024 11:55
PostgreSQL configuration without password on Ubuntu for Rails

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
@p1nox
p1nox / application.html
Last active June 26, 2017 15:40
Simple Facebook feed dialog facade using facebook-jssdk ( JavaScript or CoffeeScript )
<script type="text/javascript">
// Facebook API loading
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
@p1nox
p1nox / application_controller.rb
Last active February 24, 2017 19:04
Using Cookies.js and jquery.base64.js to parse a signed cookie generated by Rails into an JavaScript Object
# ... after succesful login
def set_current_user_cookie( user )
client_side_user_obj = { id: user.id, email: user.email }
cookies.signed[:_application_alt_session] = client_side_user_obj.to_json
end
# ...
@p1nox
p1nox / best_before.rb
Last active May 12, 2016 23:29
Groupon LatAm interview problem: Best before (Ruby)
require 'date'
def is_valid_date? year, month, day
return false if year < 2000 || year > 2999
Date::valid_date?(year, month, day)
end
class Date
def is_valid_date_for_millenium? millenium
/**
* Setup Module with `highlight` filter
*/
var JekyllApp = angular.module('JekyllApp', [], function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(false);
});
JekyllApp.filter('highlight', function () {
return function (text, filter) {
@p1nox
p1nox / postgresql_configuration_on_mac_for_rails.md
Last active November 30, 2022 10:28
PostgreSQL configuration without password on Mac for Rails

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

Go to Postgre Download Site

Install Postgre gem

/Gemfile

@p1nox
p1nox / aws.md
Last active July 15, 2020 15:10
aws
@p1nox
p1nox / using_meld_on_mac.md
Last active June 13, 2023 16:24
Using meld on Mac

Using Meld merging tool on Mac

There are two ways of installing meld on osx (May 2023), using brew and .dmg package (from @yousseb). Since I found https://yousseb.github.io/meld/, I've installed it with .dmg package, but having macOS Ventura Version 13.4 (22F66) in place, it's not even starting for me. So I tried brew installation, and the application is working as expected, including symlink to start it from the terminal.

brew install --cask meld

# set meld as your default git mergetool