Skip to content

Instantly share code, notes, and snippets.

View joseluisq's full-sized avatar

Jose Quintana joseluisq

View GitHub Profile
@joseluisq
joseluisq / FacebookCustom.php
Last active August 29, 2015 14:04
PHP Class for Facebook API handle
<?php
/**
* Class for Ajax request and response data structure
* @author Jose Luis Quintana <joseluisquintana20@gmail.com>
*/
class FacebookCustom {
private $env;
private $app_id;
@joseluisq
joseluisq / usizer.js
Created August 12, 2014 18:01
Useful class for resize DOM Javascript objects
/*
name: uSizer
description: Useful class for resize DOM objects
license: MIT-Style License <http://joseluisquintana.pe/license.txt>
copyright: Jose Luis Quintana <http://joseluisquintana.pe/>
authors: Jose Luis Quintana <joseluisquintana20@gmail.com>
*/
function uSizer(parent, child) {
this.version = '1.0';
this.child = null;
@joseluisq
joseluisq / load_async_page.js
Last active August 29, 2015 14:05
How to load only the body content from some static html page via Javascript Ajax.
// main.js
(function($){
/**
For example:
You might load pages for each links on your menu.
Eg.
<ul>
<li><a href="#about">About</a></li>
@joseluisq
joseluisq / php_excel_encoding_string.php
Last active August 29, 2015 14:06
PHP Excel encoding string
<?php
function excel_encoding_string($string) {
return mb_convert_encoding($string, 'UTF-16LE', 'UTF-8');
}
@joseluisq
joseluisq / JDirectory.php
Last active August 29, 2015 14:06
PHP Directory handler class
<?php
/**
* @author Jose Luis Quintana <joseluisquintana.pe>
*/
class JDirectory {
private $_ignore_list = array();
function ignore_list($ignore_list) {
@joseluisq
joseluisq / common_httpd_status.js
Last active August 29, 2015 14:06
Javascript Hash of Common HTTP Status
var HTTPStatusService = {
ok: {
code: 200,
msg: 'The request sent by the client was successful.'
},
bad_request: {
code: 400,
msg: 'The syntax of the request was not understood by the server.'
},
no_authorized: {
// for demo: http://jsbin.com/jeqesisa/7/edit
// for detailed comments, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " this.name == 'Sam' && this.age === '12' " }}
@joseluisq
joseluisq / sublime_text_essential_plugins.md
Last active August 29, 2015 14:07
Sublime Text Essential Plugins

Sublime Text Essential Plugins

Here some very essential and useful plugins for Sublime Text Editor.
First, it's necessary to install Package Control.

  • AutoFileName : Autocomplete Filenames in Sublime Text.
  • EditorConfig : EditorConfig helps developers maintain consistent coding styles between different editors.
  • Emmet : Emmet is a plugin for many popular text editors which greatly improves HTML & CSS
  • SCSS : Sass support.
  • SidebarEnhancements : Provides enhancements to the operations on side bar of files and folders.
@joseluisq
joseluisq / Preferences.sublime-settings
Last active August 29, 2015 14:07
My personal Sublime Text User Settings Flatland
{
"theme": "Flatland Dark.sublime-theme",
"flatland_square_tabs": true,
"color_scheme": "Packages/User/Flatland Dark (SL).tmTheme",
"flatland_sidebar_tree_small": true,
"font_face": "Monaco",
"font_size": 10,
"ignored_packages": [
"Vintage"
],
@joseluisq
joseluisq / vim_usefull_commands.md
Last active August 29, 2015 14:07
Vim usefull commands
  • gg — Move the cursor to the first line of the file.
  • G — Move the cursor to the last line of the file.
  • dd — Delete current line.
  • dG — Delete all lines of the file.
  • yy — Copy a line.
  • p — Paste the copied or deleted text after the current line.
  • P — Paste the copied or deleted text before the current line
  • u — Undo last change (can be repeated to undo preceding commands).
  • ctrl + R — Redo changes which were undone (undo the undos).