Skip to content

Instantly share code, notes, and snippets.

View fernandofleury's full-sized avatar
🐊
vrau

Fernando Fleury fernandofleury

🐊
vrau
View GitHub Profile
@fernandofleury
fernandofleury / Gruntfile.js
Created September 29, 2013 23:08
grunt.js simple test
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: 9001,
hostname: '*',
keepalive: true
@fernandofleury
fernandofleury / gist:6825858
Last active December 24, 2015 16:09
font-face example
// COMPASS GENERATOR
+font-face("Helvetica Neue", font-files("helvetica-neue.woff", "helvetica-neue.ttf", "helvetica-neue.svg"), "helvetica-neue.eot", normal, normal)
+font-face("Helvetica Neue", font-files("helvetica-neue_light.woff", "helvetica-neue_light.ttf", "helvetica-neue_light.svg"), "helvetica-neue_light.eot", 300, normal)
+font-face("Helvetica Neue", font-files("helvetica-neue_bold.woff", "helvetica-neue_bold.ttf", "helvetica-neue_bold.svg"), "helvetica-neue_bold.eot", 700, normal)
+font-face("Helvetica Neue", font-files("helvetica-neue_italic.woff", "helvetica-neue_italic.ttf", "helvetica-neue_italic.svg"), "helvetica-neue_italic.eot", normal, italic)
// RESULT
@font-face {
font-family: "Helvetica Neue";
// home.js
(function(){
'use strict';
var HomeView = Backbone.View.Extend();
var homeView = new HomeView();
})();
// router.js
var app = app || {};
// festival.js
(function(){
'use strict';
var FestivalView = Backbone.View.extend({
el: '.content',
render: function(){
var template = 'text';
this.$el.html(template);
}
app.validateForm = function(form) {
var $form = form,
$requiredFields = $form.find('[data-required="true"]'),
mailRegex = new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");
$requiredFields.each(function () {
var $this = $(this),
$element = $this.is('input') ? $this.parent() : $this;
if (!$this.val()) {
$element.addClass('error-field');
} else {
var app = app || {};
$.fn.serializeObject = function () {
var o = {};
var a = this.serializeArray();
$.each(a, function () {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
// Estrutura
// <li>
// <div class="item-about">
// <span class="item-headline">Lorem Ipsum</span>
// <span class="item-additional"><b>Lorem:</b> Ipsum</span>
// <span class="item-additional"><b>Lorem:</b> Ipsum</span>
// </div>
// <div class="item-additional">
// <span class="sub-additional"><b>Lorem:</b> Ipsum</span>
@fernandofleury
fernandofleury / gulpfile.js
Last active August 29, 2015 13:58
Error while preparing the gulpfile
(function(){
'use strict';
var gulp = require('gulp'),
browserSync = require('browser-sync'),
sass = require('gulp-ruby-sass');
gulp.task('browser-sync', function(){
browserSync.init(['*.html'], {
server: {
// exemplo de data
{
token: "Token retornado do back-end",
profile: "Perfil retornado do back-end"
}
app.storeUserData = function(data) {
sessionStorage.setItem('userData', JSON.stringify(data));
};
app.factory('AuthService', ['$http', function($http){
checkUser: function(credentials, callback) {
$http.get('/auth/check', credential)
.success(function(response){
callback(response);
});
}
}]);