Skip to content

Instantly share code, notes, and snippets.

View juanprimal's full-sized avatar
🏠
Working from home

Pedro Juan Criollo Romo juanprimal

🏠
Working from home
View GitHub Profile
@juanprimal
juanprimal / doc.md
Created May 18, 2017 17:02 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

{
"centurion_folder_icons": true,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"contrasted_light_quick_panel": true,
"contrasted_light_sidebar": true,
"contrasted_light_tabs": true,
"findreplace_small": true,
"font_face": "Courier New",
"font_size": 19.0,
"icon_file_type_enable": true,
@juanprimal
juanprimal / criteria.js
Created November 20, 2016 20:18
search key
var ladders = [
{ id: 1, height: 20 },
{ id: 3, height: 25 }
];
function findWhere(array, criteria) {
var key = Object.keys(criteria)[0];
return array.find(function(item){
return item[key] == criteria[key]
I've noticed this too. Heroku has several logging levels. You should try this:
heroku config:add LOG_LEVEL=DEBUG
heroku addons:upgrade logging:expanded
Then go to your app and get ready to hit the page with an error. But before you do do this:
heroku logs --tail
And you should be able to see the errors in you console.
=== dentro del head ===
<script>
function prevent(e) {
e.preventDefault();
}
</script>
@juanprimal
juanprimal / photos.rb
Last active August 29, 2015 14:26
Delete original image when using Paperclip/Rails 3
after_save :destroy_original
private
def destroy_original
File.unlink(self.photo.path)
end
<!DOCTYPE html>
<html lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="Ejemplo de HTML5">
<meta name="keywords" content="HTML5, CSS3, Javascript">
<title>Este texto es el título del documento</title>
<link rel="stylesheet" href="misestilos.css">
</head>
<body>
var typingTimer;
var doneTypingInterval = 700;
//Detect keystroke and only execute after the user has finish typing
function delayExecute()
{
clearTimeout(typingTimer);
typingTimer = setTimeout(
function(){somethingExecuted('typesomethinghere')},
doneTypingInterval
@juanprimal
juanprimal / gist:d81fe4c21e6fc531ec8f
Created December 11, 2014 14:10
tablet resolution
@media (min-height: 500px)
.gray_bg
border: 1px solid #0f0
@juanprimal
juanprimal / gist:e65e7585807e6ac47c29
Created October 26, 2014 20:06
fix java for osx 10.10
Install Java 8
https://www.java.com/en/download/mac_download.jsp
Add Java 8 path
JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
PATH=$JAVA_HOME/bin:$PATH