Skip to content

Instantly share code, notes, and snippets.

View sauldeleon's full-sized avatar
🎮

Saúl de León Guerrero sauldeleon

🎮
View GitHub Profile
@laurazenc
laurazenc / style.css
Created May 24, 2022 06:58
Solve blurry fonts
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@devdbrandy
devdbrandy / User.js
Last active February 1, 2023 15:01
User followers implementation with Sequelize ORM and ExpressJS
import bcrypt from 'bcryptjs';
/**
* A model class representing user resource
*
* @param {Sequelize} sequelize - Sequelize object
* @param {Sequelize.DataTypes} DataTypes - A convinient object holding data types
* @return {Sequelize.Model} - User model
*/
export default (sequelize, DataTypes) => {
@kykean
kykean / react-i18next.js
Created June 9, 2017 09:19
jest manual mock to replace react-i18next, so tests can use mount with stubs covering lifecycle methods.
// place in __mocks__/react-i18next.js , same directory level with node_modules
const i18next = jest.genMockFromModule('react-i18next');
i18next.t = (i) => i;
i18next.translate = (c) => (k) => k;
module.exports = i18next;
@srph
srph / oauth.js
Created February 21, 2016 13:50
axios: interceptor which includes your oauth token in every request as an Authorization header
import axios from 'axios';
// You can use any cookie library or whatever
// library to access your client storage.
import cookie from 'cookie-machine';
axios.interceptors.request.use(function(config) {
const token = cookie.get(__TOKEN_KEY__);
if ( token != null ) {
config.headers.Authorization = `Bearer ${token}`;
@AmirHossein
AmirHossein / coordinatestoname.js
Last active December 25, 2023 11:15
Get City and Country name by coordinates via Google Maps api
// Demo: http://jsfiddle.net/xuyp8qb5/
// Note: You need Google Map API Key to run demo; bit.ly/2pBgToW
var latlng;
latlng = new google.maps.LatLng(40.730885, -73.997383); // New York, US
//latlng = new google.maps.LatLng(37.990849233935194, 23.738339349999933); // Athens, GR
//latlng = new google.maps.LatLng(48.8567, 2.3508); // Paris, FR
//latlng = new google.maps.LatLng(47.98247572667902, -102.49018710000001); // New Town, US
//latlng = new google.maps.LatLng(35.44448406385493, 50.99001635390618); // Parand, Tehran, IR
//latlng = new google.maps.LatLng(34.66431108560504, 50.89113940078118); // Saveh, Markazi, IR
@mortezaadi
mortezaadi / persistence.xml
Last active March 13, 2023 10:54
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->