Skip to content

Instantly share code, notes, and snippets.

Juan David Pastas juanpastas

Block or report user

Report or block juanpastas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
juanpastas /
Last active Jun 13, 2017
Ruby on Rails - Simple Form AJAX Validations(works with bootstrap)
removeValidations = (scope) ->
$(scope).find('.has-error .help-block').remove()
showValidations = (errors, scope = '') ->
for field, fieldErrors of errors
wrapper = wrapperForField(field, scope)
for error in fieldErrors
wrapper.append("<div class='help-block'>#{error}</div>")
View ransack_enum_text_search.rb
Given enum like status: %i(bad good great)
ransacker(:status){ Arel.sql(ites('status')) }
will allow to perform: 'a') => returns models with bad and great statuses 'g') => returns models with good and great statuses
Another way to solve
View gist:90b48a7be3179cb0901c38168875cc4e
View gist:37d8b6ba1d5c955aac1082ba38362e76
Runtime Error
Cannot read property 'style' of null
TypeError: Cannot read property 'style' of null
at Content.addScrollPadding (
at t.invokeTask (
at e.runTask (
at invoke (
View iceberg.rb
1.upto(100).map{|i| [(175335 - i).to_f / 100000000, i.to_f/1000]}
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeOkbLTXS9XJ+yoS0ghwHw3n6NvHs+n4gPcY0B/xnMCcszbxoE+5w4O9InnNFclAAxUZeHA2E3fa14i7XnR1DWdvAUDXcQrGLxuTDuqgR47rEEOxaI/wAJmRZ05MsQtt/VI5DK+77dYNx1ebjBUPHXPFe9je3VoOBQemzLcHfUMosd9C0DmUxX+tOtS5qkALpM+j5thvUjy5Fz+Z79cxhYlWvYN3r85B0PQPaIHGbzo3TYxCrvHLYQ2Y1FDtFS2jw4wyod528lhnBBvQ4ko4BRVz08geOxjNZlGAqu0YAigMbFpsssb17jRBVK0wVbqZaD7xnapemrIFDFHuGKdHbb pills@pills-desktop
View a.html
Notification.requestPermission(function(result) {
if (result === 'granted') {
navigator.serviceWorker.ready.then(function(registration) {
registration.showNotification('Notification with ServiceWorker');


  1. User loads page
  2. Precompiled JS and CSS are included
  3. CSS references wrong font URL


  1. User loads page
  2. Precompiled JS and CSS are included
View gist:7a91ab637a89d71c8a6290db594faddf
ls | entr docco
livereloadx -s -p 3333
You can’t perform that action at this time.