Skip to content

Instantly share code, notes, and snippets.

View hackvan's full-sized avatar
🇨🇴

Diego Camacho hackvan

🇨🇴
View GitHub Profile
@lucolivier-dumaisblais
lucolivier-dumaisblais / OOP.pls
Created April 1, 2011 02:11
Example of Object-oriented programming in PL/SQL
DROP TYPE Student;
DROP TYPE Person;
CREATE OR REPLACE TYPE Person As Object (
firstName VARCHAR2(30),
lastName VARCHAR2(30),
phoneNumber CHAR(10)
) NOT FINAL;
/
CREATE OR REPLACE TYPE Student UNDER Person (
@tsabat
tsabat / zsh.md
Last active July 7, 2024 16:56
Getting oh-my-zsh to work in Ubuntu
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@daicham
daicham / gist:4109527
Created November 19, 2012 08:08
A sample ruby code of executing SQL for Oracle
# encoding: utf-8
#
# Prerequisite:
# gem install ruby-oci8
require 'oci8'
def log(message)
puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} #{message}"
end
@toronya
toronya / oracle_to_csv.rb
Last active December 29, 2015 22:20
simple example of DB table to csv (oracle)
# coding:utf-8
# usage: ruby oracle_to_csv.rb > sample.csv
require 'rubygems'
require 'oci8' # before you need install : gem install ruby-oci8
def csvout(user, pass, world, sql)
begin
ora = OCI8.new(user,pass,world)
c = ora.exec(sql)
@ppdeassis
ppdeassis / oracle_reader.rb
Created June 18, 2013 14:35
A Ruby class to acces an Oracle database
################################################################################
require 'oci8'
require 'iconv'
################################################################################
class OracleReader
################################################################################
def initialize(server, username, password)
# Open the connection.
@connection = OCI8.new(username, password, server)
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active May 28, 2024 17:41
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@dwayne
dwayne / ch1.md
Last active September 4, 2023 04:45
My notes from the book "Eloquent Ruby by Russ Olsen"

Chapter 1

Every programming community quickly converges on a style, an accepted set of idioms. Programming is all about communication and knowing those idioms are key to being a successful programmer in that community.

Ruby style of programming:

  • Code should be crystal clear, it should shout its intent
  • Good code is also concise

Ruby indentation convention:

# Based on https://gist.github.com/fernandoaleman/5083680
# Start the old vagrant
$ vagrant init ubuntu_saucy
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 22, 2024 13:51
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)