Skip to content

Instantly share code, notes, and snippets.

View zazk's full-sized avatar
:octocat:
Let's talk about Javascript & DevOps

Enrique Juan de Dios zazk

:octocat:
Let's talk about Javascript & DevOps
View GitHub Profile
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@zazk
zazk / admin.py
Created January 3, 2012 02:31
ManyToManyCMS
# -*- coding: utf-8 -*-
""" Admin Store. """
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from local_apps.store.models import Category, Order, OrderDetail, Product, \
ProductImage, Ubigeo, Video, Banner, InfoSite
class CategoryInline(admin.TabularInline):
model = Category
@zazk
zazk / models.py
Created January 6, 2012 00:07
Modelos Many to Many
class Banner(AuditableModel):
image = models.ImageField(verbose_name="Archivo", upload_to="banner/original")
position = models.IntegerField("Orden", default=0)
name = models.CharField("Nombre", max_length=120, blank=True)
url = models.CharField("Enlace", max_length=220, blank=True)
def url_normal(self):
url = "{0}/banner/normal/{1}".format(settings.MEDIA_URL, self.image)
return url
@zazk
zazk / __init__.py
Created January 15, 2012 19:05
Settings Django
# -*- coding: utf-8 -*-
"""
Settings common.
"""
from os.path import dirname, join, realpath
SITE_ROOT = dirname(dirname(realpath(__file__)))
DEBUG = True
@zazk
zazk / methodexample
Created July 26, 2012 18:35
Method Example on Objective-C
-(void) conseguirFotos:(NSString)conseguirFotos aColores:(NSBool)aColores conTag:(NSString) conTag {
//tasks
}

Template Components

Used to provide structural templates.

Pattern

t-template-name
t-template-name--modifier-name
t-template-name__subcomponent-name--subcomponent-modifier-name
@zazk
zazk / gist:7473833
Created November 14, 2013 20:32 — forked from getify/gist:603980
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}
@zazk
zazk / init.php
Created June 6, 2014 20:16
Execute an SQL Query with PDO - PHP
<?php
//Execute an SQL Query with PDO
$table = "company";
try {
$db = new PDO("mysql:dbname=socialpi_openmobile;host=localhost", "socialpi_opmo", "openmo" );
$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );//Error Handling
$sql ="
DROP TABLE IF EXISTS `contacto`;
CREATE TABLE IF NOT EXISTS `contacto` (
`contactoid` int(5) NOT NULL AUTO_INCREMENT,
#import <UIKit/UIKit.h>
@interface HighChartViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (strong, nonatomic) NSArray* seriesArray;
@property (copy, nonatomic) NSString* optionFileName;
@end