Skip to content

Instantly share code, notes, and snippets.

View JesusMurF's full-sized avatar

Jesús Mur Fontanals JesusMurF

View GitHub Profile
@JesusMurF
JesusMurF / filters.js
Last active March 22, 2019 15:07
Filtro para Angular.js que elimina las tildes a los textos y los cambia a minúsculas
.filter('slugify', function(){
return function(input){
var tittles = "ÃÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛãàáäâèéëêìíïîòóöôùúüûÑñÇç";
var original = "AAAAAEEEEIIIIOOOOUUUUaaaaaeeeeiiiioooouuuunncc";
for (var i = 0; i < tittles.length; i++) {
input = input.replace(tittles.charAt(i), original.charAt(i)).toLowerCase();
};
return input;
};
});
@JesusMurF
JesusMurF / javascript
Last active November 7, 2016 10:05
How to get the hours between two dates with Moment.js
var duration = moment.duration(end.diff(startTime));
var hours = duration.asHours();
@JesusMurF
JesusMurF / users.js
Created November 16, 2016 10:21
How to encrypt password in Sequelize
import Sequelize from 'sequelize'
import bcrypt from 'bcrypt-nodejs'
import connection from '../config/db'
require('sequelize-isunique-validator')(Sequelize)
let User = connection.define('user', {
firstName: {
type: Sequelize.STRING(50),
allowNull: false,
import time
class Offer(models.Model):
title = models.CharField(max_length=140,)
description = models.TextField(max_length=500, blank=True, null=True)
slug = models.SlugField(max_length=240, unique=True)
created_at = models.DateTimeField(auto_now_add=True, editable=False)
def __str__(self):
return self.title
@JesusMurF
JesusMurF / css
Created April 26, 2017 08:01
Atom Stylesheet
atom-workspace {
font-family: "Operator Mono";
font-size: 12px;
font-weight: 400;
}
atom-text-editor {
font-family: "Operator Mono";
font-size: 13px;
font-weight: 400;
const webpack = require('webpack')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: path.join(__dirname, './src/index.html'),
filename: 'index.html',
inject: 'body'
})
@JesusMurF
JesusMurF / User.js
Created March 31, 2018 09:28
SignIn with Instagram in Node.js
const { Schema } = require('mongoose');
const mongoose = require('mongoose');
const User = new Schema({
instagram: {
id: String,
accessToken: String,
full_name: String,
username: String,
profile_picture: String,
@JesusMurF
JesusMurF / server.js
Created March 31, 2018 09:33
Server file for Instagram SignUp
const express = require('express');
const session = require('express-session');
const passport = require('passport');
const exphbs = require('express-handlebars');
const bodyParser = require('body-parser');
require('./config/db');
const app = express();
app.engine('handlebars', exphbs({ defaultLayout: 'main' }));
@JesusMurF
JesusMurF / home.handlebars
Created May 7, 2018 19:10
Home template for instagram passport login
<h1 class="title">Inicia sesión con Instagram
<i class="fab fa-instagram"></i>
</h1>
<a class="button is-primary" href="/auth/instagram">
<span class="icon is-small">
<i class="fab fa-instagram"></i>
</span>
<span>Inicia sesión con Instagram</span>
</a>