Skip to content

Instantly share code, notes, and snippets.


Joseadrian Ochoa joseadrian

View GitHub Profile
joseadrian / app.js
Created June 18, 2020 03:27 — forked from kwhinnery/app.js
HTTP Basic Authentication with Express 4 using the http-auth module
View app.js
var express = require('express'),
auth = require('http-auth');
// Configure basic auth
var basic = auth.basic({
}, function(username, password, callback) {
callback(username == 'admin' && password == 'f00lpr00f');
joseadrian /
Created November 9, 2017 16:46 — forked from addyosmani/
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

joseadrian / acf-fields.php
Created April 4, 2017 22:21 — forked from hereswhatidid/acf-fields.php
Create custom product details tabs within WooCommerce using an ACF (Advanced Custom Fields) Repeater field.
View acf-fields.php
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'acf_product_options',
'title' => 'Product Options',
'fields' => array (
array (
'key' => 'acf_product_options_tabbedcontent_label',
'label' => 'Tabbed Content',
joseadrian / reset.sass
Created April 4, 2016 17:43 — forked from trey/reset.sass
Eric Meyer's reset.css in Sass. Originally by @postpostmodern.
View reset.sass
v2.0 | 20110126
License: none (public domain) */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
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)
View ip.conf
# 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;
joseadrian / responsive_likebox.html
Created October 27, 2015 09:29
Responsive Facebook Like Box
View responsive_likebox.html
<!DOCTYPE html>
<script src="//" type="text/javascript"></script>
<div id="container" style="width:100%;">
<div class="fb-like-box" data-href="" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>
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
View validate-selectize-fields.js
//How to validate selectize.js comboboxes with the jQuery validation plugin
//selectize.js: (brianreavis/selectize.js)
// (jzaefferer/jquery-validation)
//configure jquery validation
//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 / 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
View phpstorm-auto-semicolon-macro.txt
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
View angular.numbers_only.js
.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;