Skip to content

Instantly share code, notes, and snippets.

View lunaroja's full-sized avatar

Abraham Velazquez Tello lunaroja

View GitHub Profile
@lunaroja
lunaroja / www-data
Created September 23, 2015 05:40
Edit files files that belong to www-data
//http://askubuntu.com/questions/19898/whats-the-simplest-way-to-edit-and-add-files-to-var-www
sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www
@lunaroja
lunaroja / gulpfile.js
Last active August 29, 2015 14:19
Gulp file for Jekyll, Sass, Autoprefixer and BrowserSync
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var cp = require('child_process');
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
@lunaroja
lunaroja / mail-test.php
Created April 22, 2015 05:20
wp_mail function test
<?php
/**
* Update variable settings.
* Load to your WP root folder.
*/
// Set $to as the email you want to send the test to
$to = "";
// No need to make changes below this line
@lunaroja
lunaroja / flexbox-properties.scss
Created March 27, 2015 21:57
Flexbox Properties
// https://css-tricks.com/snippets/css/a-guide-to-flexbox/
.parent {
display: flex; /* or inline-flex */
flex-direction: row | row-reverse | column | column-reverse;
flex-wrap: nowrap | wrap | wrap-reverse;
flex-flow: <‘flex-direction’> || <‘flex-wrap’>
justify-content: flex-start | flex-end | center | space-between | space-around;
align-items: flex-start | flex-end | center | baseline | stretch;
align-content: flex-start | flex-end | center | space-between | space-around | stretch;
@lunaroja
lunaroja / browser-sync-settings.js
Created March 19, 2015 22:18
Change BrowserSync Notification Styles
// https://github.com/BrowserSync/browser-sync/issues/141
browserSync({
notify: {
styles: [
'display: none; ',
'padding: 6px 15px 3px;',
'position: fixed;',
'font-size: 0.8em;',
'z-index: 9999;',
'left: 0px;',
@lunaroja
lunaroja / wordpress-cors.php
Created March 3, 2015 06:51
Set CORS Header for WordPress JSON API
<?php
add_action( 'init', 'handle_preflight' );
function handle_preflight() {
header("Access-Control-Allow-Origin: " . get_http_origin());
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Headers: Authorization, Origin, X-Requested-With, Content-Type, Accept");
if ( 'OPTIONS' == $_SERVER['REQUEST_METHOD'] ) {
status_header(200);
exit();
@lunaroja
lunaroja / _countdown.scss
Created February 4, 2015 04:42
Film Countdown in SCSS
// Animation: Timer
// -------------------------------
// Sized for iPhone 6 .timer correct position should be set with JS
$timer-screen-width: 375px; // top: ($timer-screen-height - $timer-size) / 2;
$timer-screen-height: 667px;// left: ($timer-screen-width - $timer-size) / 2;
$timer-size: 800px;
$timer-opacity: .5;
$timer-countdown-opacity: .9;
@lunaroja
lunaroja / player.html
Created January 20, 2015 07:48
iTunes Style Play Button
<div class="player">
<button class="button-play ion-stop">
<div class="play-crop" data-anim="play-base play-crop">
<div class="play-circle" data-anim="play-base play-left"></div>
<div class="play-circle" data-anim="play-base play-right"></div>
</div>
</button>
</div>
@lunaroja
lunaroja / functions.php
Last active August 29, 2015 14:08
WP: Temp redirect non logged in users to other URL.
<?php
if (
!in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))
&& !is_admin()
&& !is_user_logged_in()
) {
wp_redirect( 'http://other-temp-site.com/', 302 ); exit;
}
@lunaroja
lunaroja / retina.scss
Created December 20, 2013 07:31
Retina Mixin
@mixin retina() {
@media only screen and (-webkit-min-device-pixel-ratio: 1.25),
only screen and (min-resolution: 120dpi) {
@content;
}
}
.icon {
background-size: 200px 40px;
background-image: url(img/icons.png);