Skip to content

Instantly share code, notes, and snippets.

View josedigital's full-sized avatar

alex rodriguez josedigital

View GitHub Profile
#!/usr/bin/env bash
# Remove old Node
sudo rm -rf $(which node)
sudo rm -rf $(which npm)
sudo rm -rf ~/.node
sudo rm -rf ~/.npm
# To insure the latest version is installed
brew update
@josedigital
josedigital / createAlias
Created November 25, 2016 02:28
create alias in bash shell (mac terminal)
cd
nano .bash_profile
alias simpleServer='python -m SimpleHTTPServer 8000'
(close file and run source ~/.bash_profile)
@josedigital
josedigital / dolla.js
Last active December 4, 2016 00:45
Vanilla JS jQuery-style selecting
// from https://modernweb.com/5-things-you-should-stop-doing-with-jquery/
// 1 result
window.$ = function(selector) {
return document.querySelector(selector);
};
// multiple results - all matched DOM elements
window.$$ = function(selector) {
// how a promise works in javascript
function doWorkPromise(data) {
return new Promise(function(resolve, reject) {
resolve('everything worked');
reject({
error: 'something bad happened'
});
});
}
@josedigital
josedigital / gh-pages-deploy.md
Created June 16, 2016 16:49 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

npm uninstall `ls -1 node_modules | tr '/\n' ' '`
@josedigital
josedigital / gulpfile.js
Created April 26, 2016 20:21 — forked from montanaflynn/gulpfile.js
Jade / Stylus Gulpfile with an express static server and livereload enabled.
var sources, destinations, lr, gulp, gutil, jade, stylus;
gulp = require('gulp');
jade = require('gulp-jade');
gutil = require('gulp-util');
stylus = require('gulp-stylus');
sources = {
jade: "jade/**/*.jade",
stylus: "stylus/**/*.stylus",
@josedigital
josedigital / reset.css
Last active November 9, 2015 13:51
A CSS Reset to Rule Them All
/* source: http://inspirationalpixels.com/snippets/css-reset */
*, *:before, *:after {
margin:0px;
padding:0px;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
border:0px;
font-size:100%;
font:inherit;
@josedigital
josedigital / jquery.alterclass.js
Created September 24, 2015 03:03 — forked from peteboere/jquery.alterclass.js
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/
@josedigital
josedigital / form-from-input-fields.php
Created April 27, 2015 04:09
form from page input fields - pw
<?php
// Get the page you need to edit
$mypage = $pages->get('/some/page/');
// Populate with the names of the fields you want to exclude OR include (see instructions below)
// Leave empty to output all the fields
$myfields = array('body', 'email');
$form = $modules->get('InputfieldForm');
$fields = $mypage->getInputfields();