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 / gist:6720244
Last active December 24, 2015 00:59
Touch and Drag a Vector Line W/Titanium & lines.mod
//Import Lines Module
var lines = require('com.lines');
//Window:
var win = Ti.UI.createWindow({
backgroundColor:'black'
});
//First event listener TouchStart the Origin Point
win.addEventListener('touchstart',function(e){
@Omar-Gonzalez
Omar-Gonzalez / easy_migration.py
Last active June 26, 2017 14:41
Merge all sql files in a directory into a single migration file
# -*- coding: UTF-8 -*-
import os
path = os.getcwd()
def build_query(path):
migration = '/* Eeasy Migration Tool - Write all the querys */ \n'
files = ""
for path, subdirs, files in os.walk(path):
for file in files:
@Omar-Gonzalez
Omar-Gonzalez / html
Created July 9, 2017 05:05
django index bootstrap - initializer
{% load static %}
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang=""> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
function isValidInput(e, mustContain){
"use strict";
if (e.target.tagName === "INPUT"){
if (e.target.value.length === mustContain){
document.getElementById("submit").disabled = false;
}else{
document.getElementById("submit").disabled = true;
}
}
}
@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'
}());
@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 / 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

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 / 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"