Skip to content

Instantly share code, notes, and snippets.

View Omar-Gonzalez's full-sized avatar
💻
code & chill

Omar González Omar-Gonzalez

💻
code & chill
View GitHub Profile
@Omar-Gonzalez
Omar-Gonzalez / webpack.config.js
Created November 9, 2018 14:34
react-django-webpack config
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry:[
'./app.jsx'
],
output:{
filename:'../pecsa.bundle.js'
},
'''
Avoid code duplication for functions
1) solve duplcation
2) Avoid mix function main logic porpuse
'''
import time
'''
Decorator function:
"""
Django settings for tienda project.
Generated by 'django-admin startproject' using Django 1.11b1.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
@Omar-Gonzalez
Omar-Gonzalez / package.json
Last active December 23, 2017 23:51
django-react-bootstrap - npm
{
"name": "django_react",
"version": "1.0.0",
"description": "django-react template",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "node test.js",
"build": "./node_modules/.bin/webpack",
"watch": "./node_modules/.bin/webpack -w"
function forTest(val){
console.log("Val test in forTest() "+val);
}
for(var i = 0; i < 10; i++){
(function(i){
setTimeout(function(){
forTest(i)
},i*100)
})(i);
@Omar-Gonzalez
Omar-Gonzalez / SCSS.md
Created September 20, 2017 06:27 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@Omar-Gonzalez
Omar-Gonzalez / docReady.js
Last active September 7, 2017 16:52
Custom Document Ready
!function(t, n) {
function e() {
if (!a) {
a = !0;
for (var t = 0; t < d.length; t++) d[t].fn.call(window, d[t].ctx);
d = [];
}
}
function o() {
"complete" === document.readyState && e();
@Omar-Gonzalez
Omar-Gonzalez / module.js
Created July 13, 2017 03:11
JS Module Pattern
//The module pattern heavily uses closures
var global = 'a global';
(function (){
//All vars and functions are in this scope only
//Still mantains access to all globals
console.log(global) //prints 'a global'
}());