Skip to content

Instantly share code, notes, and snippets.

View douglaslise's full-sized avatar

Douglas Lise douglaslise

  • Porto Alegre, Brazil
View GitHub Profile
@douglaslise
douglaslise / application.html.erb
Last active December 29, 2015 12:18
Arquivo de estilos iniciais para blog de exemplo do curso de ruby on rails
<!DOCTYPE html>
<html>
<head>
<title>Blog Curso Ruby On Rails</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>
<div class="container">
@douglaslise
douglaslise / gist:fbe5e82c2aad0e9d8abb
Created January 4, 2015 02:09
Call stack from fb error in rails 4.2
NoMethodError: undefined method `compile' for #<String:0xb382808>
from /home/douglas/.rvm/gems/ruby-2.1.4/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:17:in `to_sql'
from /home/douglas/.rvm/gems/ruby-2.1.4/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:36:in `select_all'
from /home/douglas/.rvm/gems/ruby-2.1.4/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
from /home/douglas/.rvm/gems/ruby-2.1.4/gems/activerecord-4.2.0/lib/active_record/relation/calculations.rb:264:in `execute_simple_calculation'
from /home/douglas/.rvm/gems/ruby-2.1.4/gems/activerecord-4.2.0/lib/active_record/relation/calculations.rb:221:in `perform_calculation'
from /home/douglas/.rvm/gems/ruby-2.1.4/gems/activerecord-4.2.0/lib/active_record/relation/calculations.rb:127:in `calculate'
from /home/douglas/.rvm/gems/ruby-2.1.4/gems/activerecord-4.2.0/lib/active_record/relation/calculat
declare
a clob;
begin
a := '2015-11-26 20:21:42`a,715 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WMobileServer]] I, [2015-11-26T20:21:42.715000 #29889] 2015-11-26 20:21:42,715 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WMobileServer]] I, [2015-11-26T20:21:42.715000 #29889] 2015-11-26 20:21:42,715 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WMobileServer]] I, [2015-11-26T20:21:42.715000 #29889] 2015-11-26 20:21:42,715 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WMobileServer]] I, [2015-11-26T20:21:42.715000 #29889] 2015-11-26 20:21:42,715 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WMobileServer]] I, [2015-11-26T20:21:42.715000 #29889] 2015-11-26 20:21:42,715 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WMobileServer]] I, [2015-11-26T20:21:42.715000 #29889] 2015-11-26 20:21:42,715 INFO [org.apache.catalina.core.ContainerBase.[jboss.
@douglaslise
douglaslise / arels.rb
Created March 8, 2016 17:57
SQL usando Arel
def composicao
comp = ProdutoCompos.arel_table
prod = Produto.arel_table
sql = comp.
join(prod).on(comp[:w_id_produto].eq(prod[:w_id])).
where(prod[:mob_dt_alteracao].gteq(@vendedor.last_sync).
or(comp[:mob_dt_alteracao].gteq(@vendedor.last_sync))).
take(params[:limit]).
skip(params[:offset]).
@douglaslise
douglaslise / native_js_drag_and_drop_helper.js
Last active December 11, 2019 13:19 — forked from druska/native_js_drag_and_drop_helper.js
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = document.createEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)
@douglaslise
douglaslise / eventos.css.scss
Created May 12, 2016 23:00
Custom CSS per controller and action
.home_controller.index_action {
background-color: blue;
}
@douglaslise
douglaslise / test-output.rb
Last active October 30, 2017 18:23
Elemental Test
#!/usr/bin/ruby
require 'rubygems'
require 'active_support'
# example input:
# {"output_groups":
# [{"name":"Apple HLS","outputs":
# [{"audio":[{"bitrate":48000,"sample_rate":32000,"codec":"AAC"}],"video":{"bitrate":1450000,"height":224,"width":400,"codec":"H.264"},"output_path":"/data/server/apple/apple_test_high.m3u8"},
@douglaslise
douglaslise / gist:ea992fcca7547ac2c5bde8f81e928cbc
Last active July 31, 2018 19:14 — forked from jingoro/gist:3015664
Mongoid Callback Sequence
require 'rubygems'
require 'bundler/setup'
require 'mongoid'
Mongoid.configure do |config|
config.master = Mongo::Connection.new('localhost', 27017, :logger => nil).db('mongoid-test')
end
class A
include Mongoid::Document
#!ruby
require "byebug"
require "yaml"
system("rubocop -R --auto-gen-config -ES")
system("git checkout .rubocop.yml")
todo = YAML.load_file(".rubocop_todo.yml")
todo.keys.each do |key|
puts "Fixing #{key}"
system("rubocop -a -R --only #{key} app config lib features spec")