Skip to content

Instantly share code, notes, and snippets.

View radubogdan's full-sized avatar
💪
Growing ruby muscle

Radu-Bogdan Croitoru radubogdan

💪
Growing ruby muscle
  • AutoUncle
  • Cluj-Napoca
View GitHub Profile
@radubogdan
radubogdan / attachment.rb
Created February 21, 2020 11:33 — forked from madwork/attachment.rb
Polymorphic attachments with CarrierWave and nested_attributes
class Attachment < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
# Associations
belongs_to :attached_item, polymorphic: true
# Validations
validates_presence_of :attachment
@radubogdan
radubogdan / postgres_queries_and_commands.sql
Created March 27, 2018 10:20 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

Keybase proof

I hereby claim:

  • I am radubogdan on github.
  • I am radubogdan (https://keybase.io/radubogdan) on keybase.
  • I have a public key ASCtFlow6ErshL1_k_xaf5NwBWRPy_LMMtzt8EWvJ103QAo

To claim this, I am signing this object:

#!/usr/bin/env bash
# Use prozicerisiverbatori.ro in terminal
# Put this script in /usr/local/bin and make it +x
#
# Example of output with cowsay:
# $ dada | cowsay
# _________________________________________
# / Cu obrazul gros și semeț și cată-le \
# \ și încălțare. /
# -----------------------------------------
@radubogdan
radubogdan / gist:f1c9899048bbc79e10f1
Created April 7, 2015 19:01
facebook birthday thanks giver
require 'mechanize'
base = 'https://graph.facebook.com/v2.3/'
route = 'me/feed?since=06.04.2015'
access_token = {'access_token' => ENV['ACCESS_TOKEN']}
variations = %w(happy bday birthday mulți multi ani trăiești traiesti)
agent = Mechanize.new
response = JSON.parse(agent.get(base + route, access_token).body)
?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])