Skip to content

Instantly share code, notes, and snippets.

View nateluzod's full-sized avatar
🎯
Focusing

Nate Luzod nateluzod

🎯
Focusing
View GitHub Profile
@nateluzod
nateluzod / gist:2698437
Created May 15, 2012 01:35
Import SQL from Terminal
mysql -u root -p -h localhost foo <bar.sql
@nateluzod
nateluzod / gist:2728519
Created May 19, 2012 01:39
Zebra Striping with JSP
<c:forEach varStatus="loopStatus">
<tr class="${loopStatus.index % 2 == 0 ? 'odd' : 'even'}">
...
@nateluzod
nateluzod / gist:4645893
Created January 27, 2013 02:25
Looping through list of custom post types.
<?php $loop = new WP_Query( array( 'post_type' => 'post_type', 'posts_per_page' => 10 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<article>
<a href="<?= get_permalink();?>"><h2><?= the_title();?></h2></a>
<?php the_excerpt(); ?>
</article>
<?php endwhile; ?>
@nateluzod
nateluzod / gist:4645900
Last active December 11, 2015 18:59
Create custom post type in WordPress. This needs to go in the functions.php of your theme file.
add_action( 'init', 'create_type' );
function create_type() {
register_post_type( 'type',
array(
'labels' => array(
'name' => __( 'Types' ),
'singular_name' => __( 'Type' )
),
'public' => true,
'has_archive' => true,
@nateluzod
nateluzod / gist:4645975
Created January 27, 2013 02:49
Show or hide things from users in admin panel in WordPress. Place in functions.php of your theme.
function remove_menus () {
global $menu;
$restricted = array(
// __('Dashboard'),
__('Posts'),
// __('Media'),
// __('Links'),
// __('Pages'),
// __('Appearance'),
// __('Tools'),
@nateluzod
nateluzod / gist:6543384
Created September 12, 2013 20:36
JS for mobile scaling
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
var viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0';
document.body.addEventListener('gesturestart', function () {
viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
}, false);
}
}
@nateluzod
nateluzod / gist:8048808
Created December 20, 2013 00:52
Installing MySQL via brew install, if errors on start
$ mkdir -p ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ mysql.server start
@nateluzod
nateluzod / gist:9263873
Created February 28, 2014 02:15
Gulp Install Base
npm install --save-dev gulp gulp-util gulp-uglify gulp-watch gulp-concat gulp-notify gulp-livereload gulp-ruby-sass
@nateluzod
nateluzod / gist:ef65f98e4d5d7e1a8ee1
Created August 24, 2014 10:21
Get public ssh key
pbcopy < ~/.ssh/id_rsa.pub
@nateluzod
nateluzod / gist:62e15031f2a65123ae7d
Last active September 7, 2016 17:59
Remove wp-content/uploads from git history
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch wp-content/uploads" HEAD