Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View roadev's full-sized avatar
🎯
Focusing

Juan Roa roadev

🎯
Focusing
View GitHub Profile
@roadev
roadev / rails_server_output_merit.rb
Created August 1, 2015 05:09
My view doesn't show the corrent amount of earned points - merit gem
Started POST "/solucions" for 127.0.0.1 at 2015-08-01 00:05:47 -0500
ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by SolucionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"S2gf6bbCbA33KY2NNTk3F3lnBcwOFUuk0jJHgKLY3D0=", "solucion"=>{"micropost_id"=>"1", "solucion"=>"This is the content"}, "commit"=>"Crear Solución"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
/home/jroa/.rvm/gems/ruby-2.2.1/gems/activerecord-4.0.4/lib/active_record/associations/has_many_association.rb:76: warning: circular argument reference - reflection
/home/jroa/.rvm/gems/ruby-2.2.1/gems/activerecord-4.0.4/lib/active_record/associations/has_many_association.rb:80: warning: circular argument reference - reflection
/home/jroa/.rvm/gems/ruby-2.2.1/gems/activerecord-4.0.4/lib/active_record/associations/has_many_association.rb:84: warning: circular argument reference - reflection
/home/j
@camilonova
camilonova / script.js
Last active June 4, 2016 22:53
Utilizando la sucursal virtual de bancolombia es frustrante tener que escribir la clave con el teclado virtual y ver esa alerta del navegador. Pega el contenido de este script en la consola del navegador para que puedas escribir la clave con el teclado. Ver en acción: http://giphy.com/gifs/l0K4hGF22s2AojfAA
function blockEnter(evt) {return true;}
function validarNoUsarTecladoReal_OnKeyPress(_object){return false;}
/**
* An implementation for Quicksort. Doesn't
* perform as well as the native Array.sort
* and also runs the risk of a stack overflow
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
* array.push(Math.round(Math.random() * 100));
<!-- in the header -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="scripts/jquery-2.1.1.min.js"><\/script>')</script>
<!-- document ready -->
<script>
$(document).ready(function() {
var customHTML = "<h2>Jeg elsker brød</h2>"
@marulango
marulango / reset.css
Created October 20, 2015 23:16
Hoja de estilo para eliminar inconsistencias a través de navegadores
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
require 'csv'
CSV.foreach('app/services/rg_list.csv', headers: true) do |row|
Person.find_or_create_by name: row['Name'].to_s.split.map(&:capitalize).join(' '), email: row['Email'].to_s.downcase, gender: row['Gender'].to_s.downcase
end
CSV.foreach('app/services/rg17_register_full.csv', headers: true) do |row|
Person.find_or_create_by name: row['Name'].to_s.split.map(&:capitalize).join(' '), email: row['Email'].to_s.downcase.strip, gender: row['Gender'].to_s.downcase, register_date: row['register_date'].to_s.downcase, birth_date: row['birth_date'].to_s, phone: row['phone'].to_s.downcase.strip, level: row['level'].to_s.downcase, motivation: row['motivation'].to_s.downcase, heard_ror: row['heard_ror'].to_s.downcase, laptop: row['laptop'].to_s.downcase, so: row['so'].to_s.downcase, expectation: row['expectation'].to_s.downcase, how_did_you_find_it: row['how_did_you_find_it'].to_s.downcase
end
@danharper
danharper / a.md
Last active September 2, 2020 17:13
Laravel Queue Supervisor

Install Supervisor with sudo apt-get install supervisor. Ensure it's started with sudo service supervisor restart.

In /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread. And start using those changes with: sudo supervisorctl update.

@digitalspaceport
digitalspaceport / gist:d8904efda4d5997a2f0e9caf31cff1c3
Last active June 24, 2021 20:45
1 liner to compile MadMax Chia plotter for Centos 7.
yum -y update
yum install vim -y
yum install htop -y
yum install git -y
yum -y install epel-release -y
yum install cmake3 gmp-devel libsodium gmp-static libsodium-static -y
yum -y install centos-release-scl -y
yum -y install cmake3 -y
sudo alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
@cmoulton
cmoulton / UISwiftRestDemo
Last active September 9, 2021 21:01
Quick & dirty REST API calls with Swift 2.2. See http://grokswift.com/simple-rest-with-swift/
// MARK: Using NSURLSession
// Get first todo item
let todoEndpoint: String = "http://jsonplaceholder.typicode.com/todos/1"
guard let url = NSURL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = NSURLRequest(URL: url)
@benoror
benoror / user.rb
Created May 20, 2011 01:38
devise_invitable: Confirm after set password
class User < ActiveRecord::Base
devise :invitable, :database_authenticatable, :registerable, :recoverable,
:rememberable, :confirmable, :validatable, :encryptable
# ...
# devise confirm! method overriden
def confirm!
welcome_message
super