Skip to content

Instantly share code, notes, and snippets.

View rssilva's full-sized avatar

Rafael Specht da Silva rssilva

View GitHub Profile
var Human = function (name, age) {
return {
init: function () {
this.setName(name);
this.setAge(age);
},
setName: function (name) {
this.setName = name;
},
@rssilva
rssilva / example-require.js
Created October 22, 2013 17:57
A simple way to use Requirejs with Backbone, Underscore and Jquery. The different widgets and features can stay on different files and everything it'll be fine when you load require.js and the AppBootstrap.js files. After you can add the "page controller" script wich will load everything you need.
/*
* AppBootstrap.js - This file contains the path to Backbone, Underscore, Jquery and
*also the variables that which one will export
*/
/*global require*/
'use strict';
require.config({
shim: {
var n = 10
var C = function () {
this.s = function (a, b) {
return a + b
}
var numero = 10;
var Calculadora = function () {
this.soma = function (numero1, numero2) {
return numero1 + numero2
}
//Os eventos 'pageinit' e 'pagecreate' são chamados
//quando exibimos uma página pela primeira vez...
//vamos criar um objeto chamado app
var app = {};
$(document).bind('pageinit', function (ev) {
//toda vez que chamarmos esse novo evento
//checaremos se a propriedade 'loaded'
//existe e é verdadeira. Caso contrário instanciamos
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
<link rel="stylesheet" href="lib/jquery.mobile-1.3.0/jquery.mobile-1.3.0.css" />
<script type="text/javascript" src="lib/jquery-1.8.3.js"></script>
<script type="text/javascript" src="lib/jquery.mobile-1.3.0/jquery.mobile-1.3.0.min.js"></script>
<script type="text/javascript" src="js/transition-test.js"></script>
</head>
//aqui temos o json com dados que devemos exibir para o usuário
var employeesListByCompany = [
{
name: 'Death Star',
employees: [
{
name: 'Darth Vader',
email: 'lukesfather@deathstar.com'
},
@rssilva
rssilva / index.html
Last active December 16, 2015 05:39
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Teste COM Templates</title>
<style type="text/css">
.employee-name {
list-style: none;
}
.employee-data {
list-style: none;
//Aqui temos o json que poderíamos receber do back-end
//uma lista de empresas que tem uma lista de funcionários
//que tem nome e email
var employeesListByCompany = [
{
name: 'Death Star',
employees: [
{
name: 'Darth Vader',
email: 'lukesfather@deathstar.com'
@rssilva
rssilva / index.html
Last active December 16, 2015 05:39
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Teste SEM template</title>
<style type="text/css">
.employees {
list-style: none;
}
.employee-data {
list-style: none;