Skip to content

Instantly share code, notes, and snippets.

View rbngzlv's full-sized avatar

Rubén González rbngzlv

  • Fanatik Coders
  • Barcelona
View GitHub Profile
@rbngzlv
rbngzlv / how_to_concerns.md
Created November 28, 2018 17:16 — forked from jhjguxin/how_to_concerns.md
how to concerns with rails 3
@rbngzlv
rbngzlv / manual-uninstall-paragon-ntfs.sh
Created October 13, 2018 15:51 — forked from guycalledseven/manual-uninstall-paragon-ntfs.sh
Manually remove Paragon NTFS v15 leftovers MacOS
# after appcleaner does his magic, do this
sudo rm -rf "/Library/Application Support/Paragon Software/"
sudo rm /Library/LaunchDaemons/com.paragon-software.installer.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfsd.plist
sudo rm /Library/LaunchAgents/com.paragon-software.ntfs.notification-agent.plist
sudo rm -rf /Library/Filesystems/ufsd_NTFS.fs/
sudo rm -rf /Library/PrivilegedHelperTools/com.paragon-software.installer
sudo rm -rf /Library/Extensions/ufsd_NTFS.kext/
@rbngzlv
rbngzlv / README.md
Created October 4, 2018 08:47 — forked from hugolpz/README.md
Printing map.svg file via D3js, Nodejs, Jsdom

D3 map client & server side

Minimal demo on how to create maps both :

  1. client side via d3js, topojson, & queue.js
  2. server side via exact same ressources + nodejs.

JS

  • d3.v3.min.js
  • topojson.v1.min.js
@rbngzlv
rbngzlv / Ruby Database Url -> Config YAML
Created July 26, 2018 15:10 — forked from pricees/Ruby Database Url -> Config YAML
Rails database connection, url to yaml
#########################################################
#
# This method takes a db connection url and returns rails
# config YAML
#
##########################################################
require "uri"
require "yaml"
@rbngzlv
rbngzlv / gist:41c33e60a573b40c1e04d1d44a17341b
Created June 8, 2018 18:57 — forked from eprothro/gist:6243211
Foundation Custom Forms Select Capybara Helper

Helper Module

# spec/support/custom_forms_helper.rb
module CustomFormsHelper
  def foundation_select(option, opts={})
    # Zurb Foundation adds custom markup after (and then hides)
    # the originating select. Here we simulate the user's interaction
    # with the custom form instead of just setting the hidden originating select's value
    originating_select_name = opts[:from]
@rbngzlv
rbngzlv / circle.yml
Created May 13, 2018 16:32 — forked from toadkicker/circle.yml
CircleCI 2.0 configuration for Ruby on Rails 5.1+ with headless chromedriver
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.5.1-node-browsers
@rbngzlv
rbngzlv / README.md
Created April 14, 2018 19:23 — forked from steffentchr/README.md
An example of how to verify SAML/XML signatures, execute in Ruby. Adapted from https://github.com/zendesk/samlr/.

It's hard to find a good example of how to verify SAML signatures online. There are plenty magic that "just calls a Java method" -- but few clear step-by-step guide.

This gist covers the signature check of a SAML response in Ruby, and as such it's also an example of how to verify an XML Secure.

The code here is lifted entirely from Morten Primdahls and Zendesks awesome SAMLR library.

@rbngzlv
rbngzlv / hook.io_commit_author_spoof_check.js
Created February 14, 2018 19:21 — forked from ric2b/hook.io_commit_author_spoof_check.js
Hook.io webhook to prevent Github commits spoofed by the pusher (not authored by him. git allows you to modify commit authors at will, so you can impersonate other users)
// The hook variable has a bunch of information about the request, check hook.io's documentation to learn more about it
module['exports'] = function accessRequestData (hook) {
var request = require('request');
var OAuth_token = hook.env.token;
// After creating your token on Github.com -> Settings -> Personal access tokens,
// add the token as an environment variable names 'token' on hook.io.
var params = hook.params;
var pusher = params.pusher;
var repo = params.repository.full_name;
@rbngzlv
rbngzlv / currency.erl
Created February 5, 2018 18:19 — forked from mlersch/currency.erl
A Erlang snippet to convert a currency strings or binary to a integer
-author("mlersch").
-module(currency).
-export([test/0, convert/1]).
convert(V) when is_binary(V) -> convert(binary_to_list(V));
convert(V) when is_float(V) -> round(V*100);
convert(V) when is_integer(V) -> V*100;
convert(V) when is_list(V) ->
V1 = re:replace(re:replace(V, "[^0-9 ^, ^.]", "", [{return,list},unicode,global]), "\\h", "", [{return,list},global]),
@rbngzlv
rbngzlv / sign-pdf.rb
Created October 6, 2017 15:51 — forked from matiaskorhonen/sign-pdf.rb
Quick and dirty PDF signing in Ruby (using Origami)
#!/usr/bin/env ruby
require "openssl"
require "time"
begin
require "origami"
rescue LoadError
abort "origami not installed: gem install origami"
end