Skip to content

Instantly share code, notes, and snippets.

View giancorzo's full-sized avatar

Giancarlo Corzo giancorzo

View GitHub Profile
@giancorzo
giancorzo / index.html
Last active October 7, 2015 04:53
Bootstrap initial template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Plantilla Bootstrap 101</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
#nota1 = 13
#nota2 = 15
#nota3 = 20
#nota4 = 4
#nota5 = 8
notas = [13,15,20,4,8]
#for i in 0...notas.length
# puts 1 + notas[i]
class Users::RegistrationsController < Devise::RegistrationsController
before_filter :configure_permitted_parameters
def create
build_resource(sign_up_params)
resource.save
yield resource if block_given?
@giancorzo
giancorzo / createElement.js
Created May 3, 2017 20:05
Clide side templating vs Javascript templating
((title,bodyText) => {
var div = document.createElement("div");
div.className = "entry";
var h1 = document.createElement("h1");
var textH1 = document.createTextNode(title);
h1.appendChild(textH1);
var innerDiv = document.createElement("div");
innerDiv.className = "body";
@giancorzo
giancorzo / template.html
Last active May 4, 2017 17:52
Client side templating
<div id="entries"></div>
<script id="entry-template" type="text/x-handlebars-template">
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{body}}
</div>
</div>
</script>
(() => {
//Compile
var source = $('#entry-template').html();
var template = Handlebars.compile(source);
//Get data
var context = {title: "My New Post", body: "This is my first post!"};
var context2 = {title: "Another Post", body: "This is another post!"};
//Create HTML elements
<div id="entries">
<div class="entry">
<h1>My New Posty</h1>
<div class="body">
This is my first post!
</div>
</div>
<div class="entry">
<h1>Another Post</h1>
<div class="body">
var template = '<div class="entry">{{entryBody}}</div>';
<script id="myTemplate" type="text/x-handlebars-template">
<h1>{{title}}</h1>
<ul>
{{#names}}
<li>{{name}}</li>
{{/names}}
</ul>
</script>
console.log('Primero');
console.log('Segundo');
console.log('Tercero');