Skip to content

Instantly share code, notes, and snippets.

View mcka1n's full-sized avatar

Edwin Maldonado mcka1n

View GitHub Profile
@mcka1n
mcka1n / postgresql_configuration_on_ubuntu_for_rails.md
Created July 28, 2017 13:49 — forked from p1nox/postgresql_configuration_on_ubuntu_for_rails.md
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
@mcka1n
mcka1n / RGBAImage.swift
Created September 23, 2016 03:41
ImageProcessor - Sources - RGBAImage . swift
import UIKit
public struct Pixel {
public var value: UInt32
public var red: UInt8 {
get {
return UInt8(value & 0xFF)
}
set {
@mcka1n
mcka1n / customer.ssl_cipher
Created September 13, 2016 20:44
customer.ssl_cipher
# customer.ssl_cipher
# /etc/nginx/servers/app-name-here/customer.ssl_cipher
# SSLv3 removed because of CVE-2014-3566 (POODLE - Padding Oracle On Downgraded Legacy Encryption)
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
@mcka1n
mcka1n / capybara cheat sheet
Created July 29, 2016 21:51 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@mcka1n
mcka1n / gist:ae42964898802640f16c4a5fe2ce5ca0
Created June 8, 2016 02:11 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@mcka1n
mcka1n / application_controller.rb
Created April 15, 2016 21:26
Rails Basic Auth
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :authenticate
private
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "tu_user" && password == "tu_password"
end
@mcka1n
mcka1n / gist:b6be8b24e07bbb5e48eb
Created November 22, 2015 20:58 — forked from mikestone14/gist:11198630
Getting a GoDaddy domain to point to a Heroku app.
@mcka1n
mcka1n / shopicruit.rb
Created October 29, 2015 04:41
shopicruit.rb, calculates how much all lamps and wallets would cost. Just run `ruby shopicruit.rb`
require 'net/http'
require 'json'
def get_products
url = URI.parse('http://shopicruit.myshopify.com/products.json')
req = Net::HTTP::Get.new(url.to_s)
response = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
@mcka1n
mcka1n / response-factura.xml
Created September 28, 2015 21:10
Response Factura (Error)
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GeneraDTEResponse xmlns="http://www.cofidi.com.gt/">
<GeneraDTEResult>&lt;EI&gt;
&lt;INVOICES&gt;
&lt;INVOICE FolioInterno="" TipoDeComprobante="" status="03" folio_fiscal="" serie_fiscal="" error_message="Error al tratar de importar el documento Ref:Object reference not set to an instance of an object." sello="" anoAprobacion="" noAprobacion="" noCertificado="" cadenaOriginal="" FechaHoraExpedicion="2015-09-21T12:37:35.943"/&gt;
&lt;/INVOICES&gt;
&lt;/EI&gt;
</GeneraDTEResult>
@mcka1n
mcka1n / request-factura.xml
Created September 28, 2015 21:09
Request Factura XML
<x:Envelope xmlns:x="http://schemas.xmlsoap.org/soap/envelope/" xmlns:www="http://www.cofidi.com.gt/">
<x:Header/>
<x:Body>
<www:GeneraDTE>
<www:Empresa>0000CLAS01</www:Empresa>
<www:Dominio></www:Dominio>
<www:Usuario>NuestroUserario</www:Usuario>
<www:Contraseña>LaContrasenia</www:Contraseña>
<www:Archivo>xml</www:Archivo>
<www:Tipo>02</www:Tipo>