Skip to content

Instantly share code, notes, and snippets.

app.post("/movies/:id/comment", async (req, res) => {
const { id } = req.params;
const { name, comment } = req.body;
const [res] = await knex.raw(
"insert into comments(comment, name, movie_id) values (?, ?, ?) returning id;"
[name, comment, id],
);
const [newComment] = await knex.raw("select * from comments where id = ? limit 1;", res[0]);
res.staus(200).json(newComment);
});

Keybase proof

I hereby claim:

  • I am hgsigner on github.
  • I am hugodorea (https://keybase.io/hugodorea) on keybase.
  • I have a public key whose fingerprint is 328D D636 005D C31B B77F 88F6 D582 8884 034D 7516

To claim this, I am signing this object:

@hgsigner
hgsigner / ssl_problem
Created August 1, 2017 18:41
Rubygems ssl problem
Remove rvm
$ rvm implode
Install rbenv
$ brew intall rbenv
$ rbenv init
Run this:
rvm reinstall --disable-binary x.x.x <= (x.x.x is the ruby version)

Keybase proof

I hereby claim:

  • I am hgsigner on github.
  • I am hugodorea (https://keybase.io/hugodorea) on keybase.
  • I have a public key whose fingerprint is 9D66 E1F7 B82B 2F2F 2C2B 8CE8 AC44 0E57 2166 A791

To claim this, I am signing this object:

-module(useless).
-export([add/2, hello/0, greet_and_add_two/1, len/1, tail_fac/1, tail_fac/2]).
add(A,B) ->
A + B.
%% Shows greetings.
%% io:format/1 is the standard function used to output text.
hello() ->
io:format("Hello, world!~n").
@hgsigner
hgsigner / gist:7255659
Created October 31, 2013 19:45
User model for the socialadega
class User
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include ActiveModel::SecurePassword
has_many :feeds
has_many :feed_comments
has_many :corks
has_many :wine_comments
@hgsigner
hgsigner / gist:7223074
Created October 29, 2013 21:36
Rails code sample
class PublicController < ApplicationController
layout 'public'
before_filter :confirm_client_logged_in
before_filter :public_current_album
before_filter :public_selected_assets
before_filter :check_amount_picked, :only => [:confirm_album, :create_album_confirmation]
before_filter :check_if_is_avaiabled