Skip to content

Instantly share code, notes, and snippets.

View joseadrian's full-sized avatar

Joseadrian Ochoa joseadrian

View GitHub Profile
[
{
"keys": ["super+alt+shift+5"],
"command": "set_layout",
"caption" : "1-2 Grid",
"args":
{
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.5, 1.0],
"cells":
<?php
define('VERIFY_TOKEN', 'yourappssecret');
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'GET' && $_GET['hub_mode'] == 'subscribe' && $_GET['hub_verify_token'] == VERIFY_TOKEN) {
echo $_GET['hub_challenge'];
} else if ($method == 'POST') {
$updates = json_decode(file_get_contents("php://input"), true);
<?php
// https://github.com/GerHobbelt/nicejson-php/blob/master/nicejson.php
// original code: http://www.daveperrett.com/articles/2008/03/11/format-json-with-php/
// adapted to allow native functionality in php version >= 5.4.0
/**
* Format a flat JSON string to make it more human-readable
*
@joseadrian
joseadrian / Sublime Text URL Launcher.md
Last active August 29, 2015 14:05 — forked from pitpit/Sublime Text 2 URL Launcher.md
Script to make "Jump to file" of PHP-Console extension work with Sublime Text on OS X

This step by step explains how to create an URI protocol (a scheme) to directly edit a file in Sublime Text from browser (or from the terminal), and mostly from notifications of the PHP-Console extension.

Create the URI launcher for "editor://" URI

Launch AppleScript and export the open_editor.scpt script as an Application (name it "Sublime Text URL Launcher").

imgur

Edit Info.plist

/* Side notes for calling out things
-------------------------------------------------- */
/* Base styles (regardless of theme) */
.bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;
.directive('numbersOnly', function () {
return {
restrict: 'A',
link: function (scope, elm, attrs, ctrl) {
// record ctrl key being down for ctrl+v and ctrl+c
var ctrlDown = false;
// reset the ctrl key flag on keyup
elm.on('keyup', function (event) {
ctrlDown = false;
});
@joseadrian
joseadrian / phpstorm-auto-semicolon-macro.txt
Last active August 29, 2015 14:26 — forked from umidjons/phpstorm-auto-semicolon-macro.txt
PhpStorm: Record Auto semicolon macro and bind shortcut to it
Record Auto semicolon macro and bind shortcut to it:
1. Edit -> Macros -> Start Macro Recording
2. In the editor go to the end of line by pressing End
3. put semicolon ';'
4. Edit -> Macros -> Stop Macro Recording
5. Give a name, for example 'Auto semicolon'
6. Open settings (Ctrl + Alt + s), select Keymap
7. Expand Macros node
8. Select 'Auto semicolon', in the context menu choose Add Keyboard Shortcut
9. Set Ctrl + ; as First keystroke
@joseadrian
joseadrian / validate-selectize-fields.js
Created October 2, 2015 03:33 — forked from yannleretaille/validate-selectize-fields.js
How to validate selectize.js comboboxes with the jQuery validation plugin
//How to validate selectize.js comboboxes with the jQuery validation plugin
//selectize.js: http://brianreavis.github.io/selectize.js/ (brianreavis/selectize.js)
//http://jqueryvalidation.org (jzaefferer/jquery-validation)
//configure jquery validation
$("#commentForm").validate({
//the default ignore selector is ':hidden', the following selectors restore the default behaviour when using selectize.js
//:hidden:not([class~=selectized]) | selects all hidden elements, but not the original selects/inputs hidden by selectize
//:hidden > .selectized | to restore the behaviour of the default selector, the original selects/inputs are only validated if their parent is visible
//.selectize-control .selectize-input input | this rule is not really necessary, but ensures that the temporary inputs created by selectize on the fly are never validated
@joseadrian
joseadrian / responsive_likebox.html
Created October 27, 2015 09:29
Responsive Facebook Like Box
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container" style="width:100%;">
<div class="fb-like-box" data-href="https://www.facebook.com/adobegocreate" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>
</div>
@joseadrian
joseadrian / ip.conf
Created October 28, 2015 05:25 — forked from mishak87/ip.conf
Nginx: Support only requests with Host header (disable access via bare IP)
# this file blocks ip requests - only request with Host are supported
server {
listen 80 default_server;
listen 443 default_server ssl;
server_name _;
return 444;
}