Skip to content

Instantly share code, notes, and snippets.

View lunaroja's full-sized avatar

Abraham Velazquez Tello lunaroja

View GitHub Profile
@lunaroja
lunaroja / allElementStyles.js
Last active August 3, 2017 19:22
Get all elements and fine out which has a specific style value
// simple way to debug which elements are loading a specific font weight so you can remove them
const allElements = document.querySelectorAll('body *');
for (var element of allElements) {
let styles = window.getComputedStyle(element)
let weight = styles.getPropertyValue('font-weight');
if (weight !== 'normal') {
console.log(element, weight);
}
}
@lunaroja
lunaroja / gulpfile.js
Created February 16, 2017 01:02 — forked from xzyfer/gulpfile.js
True incremental sass compilation
var production = process.env.APP_ENV === "test";
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var cssmin = require('gulp-minify-css');
var prefix = require('gulp-autoprefixer');
var newer = require('gulp-newer');
var print = require('gulp-print');
var notify = require('gulp-notify');
var batch = require('gulp-batch');
@lunaroja
lunaroja / wp_redirect_not_loggedin.php
Created December 1, 2016 05:38
wp_redirect_not_loggedin
<?php
$redirect_url = 'https://google.com/';
if ($redirect_url && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))
&& !is_admin() && !is_user_logged_in()) {
wp_redirect( $redirect_url , 302 ); exit;
}
@lunaroja
lunaroja / running_jekyll-cloud-9.md
Last active October 20, 2016 23:59 — forked from michaelhiiva/running_jekyll-cloud-9.md
Running Jekyll on Cloud9

Run Jekyll in the Cloud9

Running jekyll projects on Cloud 9 requires this jekyll serve -H $IP -P $PORT --baseurl "" command in the terminal.

Setting up a new run configuration

  1. Under the menu select Run > Run Configuration > New Run Configuration.
  2. Then enter jekyll serve -H $IP -P $PORT --baseurl "" for the Command.
  3. Then enter Jekyll for the Run Configuration. This will ensure that you can access it quickly in the Run > Run Configuration > Jekyll.
@lunaroja
lunaroja / wp_login_redirect.php
Last active September 15, 2016 09:26
require login to see wordpress site
<?php
function login_redirect() {
global $pagenow;
if(!is_user_logged_in() && $pagenow != 'wp-login.php') {
auth_redirect();
} else {
return site_url();
}
}
add_action( 'wp', 'login_redirect' );
@lunaroja
lunaroja / Clay.scss
Last active September 14, 2016 06:00
Clay, a simple collections of Sass patterns
// ----
// libsass (v3.3.6)
// ----
// Breakpoints, setter and mixins for mobile-first layouts
// =============================================================================
$-breakpoints: () !global;
@mixin breakpoint-set($breakpoint-name, $min-width) {
@lunaroja
lunaroja / imagesizes.sh
Created June 9, 2016 03:42
json with image dimensions from directory
function imagesizes() {
for filename in *; do
imgsize "$filename"
done
}
function imgsize() {
local width height
if [[ -f $1 ]]; then
height=$(sips -g pixelHeight "$1"|tail -n 1|awk '{print $2}')
@lunaroja
lunaroja / new_machine.sh
Last active November 29, 2018 17:23
Quick Commands to setup a new computer
#!/bin/bash
defaults write com.apple.finder AppleShowAllFiles YES
## Xcode Tools
xcode-select --install
## [Setup oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
{
"boss": true,
"browser": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
@lunaroja
lunaroja / StackScript.sh
Created February 4, 2016 05:33
StackScript Bash Library
#!/bin/bash
#
# StackScript Bash Library
# https://www.linode.com/stackscripts/view/1
#
# Copyright (c) 2010 Linode LLC / Christopher S. Aker <caker@linode.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: