Skip to content

Instantly share code, notes, and snippets.

View j0lvera's full-sized avatar
🎯
Focusing

Juan Olvera j0lvera

🎯
Focusing
View GitHub Profile
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;
@j0lvera
j0lvera / .jshintrc
Created December 20, 2013 03:24 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
@j0lvera
j0lvera / wpinstall
Created December 20, 2013 06:22
Install WordPRess
#!/bin/bash -e
# Install WordPress and clean the folder
echo "======================"
echo " Installing WordPress "
echo "======================"
echo ""
# Download the files (cURL works fine here too)
wget http://wordpress.org/latest.tar.gz
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
@j0lvera
j0lvera / app.html
Created December 25, 2013 02:34 — forked from addyosmani/app.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Backbone.js • TodoMVC</title>
<link rel="stylesheet" href="../../assets/base.css">
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
@j0lvera
j0lvera / stuff.md
Created December 25, 2013 02:35 — forked from addyosmani/stuff.md

// Changes for Essential JS design patterns

// jQuery Module pattern for plugins

!function(exports, $, undefined){

    var Plugin = function(){

        // Our private API

Generally one implements notifications by listening for events on specific models but if one wishes to have a single global message interchange, it could be done as follows:

var pubsub = new Backbone.Model;

View1 = Backbone.View.extend({
  initialize: function(){
    pubsub.bind('custom event', callback);
  }
 // ...
@j0lvera
j0lvera / backboneStickitExample.js
Last active January 1, 2016 21:59
Backbone.stickit Example
var Product = Backbone.Model.extend({});
var ProductView = Backbone.View.extend({
template: _.template("<h1 id='name'></h1><p id='price'></p>"),
bindings: {
"#name": { modelAttr: "name" },
"#price": { modelAttr: "price", format: 'formatPrice' }
},
render: function() {
this.el.innerHTML = this.template();
@j0lvera
j0lvera / info.md
Last active January 2, 2016 00:59
Info for add custom fields on Berkel

How to add custom fields

To add a custom field, we need to edit 3 files, these are described below

to edit page displays

/newsite/wp-content/themes/CherryFramework/loop/loop-single-portfolio.php

to edit portfolio options

@j0lvera
j0lvera / decorator.py
Last active June 1, 2021 20:33
bottle.py basic auth examples
from bottle import route, run, auth_basic
from passlib.hash import sha256_crypt
def check_pass(username, password):
hashed = ''.join(redis.hmget(username, "password"))
return sha256_crypt.verify(password, hashed)
@route('/', method='GET')
@auth_basic(check_pass) # <-- decorator
def index():