Skip to content

Instantly share code, notes, and snippets.

View Lukas238's full-sized avatar
🏠
Working from home

Lucas Dasso Lukas238

🏠
Working from home
View GitHub Profile

Youtube API3 + jQuery: Playlist items to itemsHTML and Magnific Popup

Retive a JSON of videos by video ID and build the HTML for the videos.

A Pen by Lucas Dasso on CodePen.

License.

@Lukas238
Lukas238 / PHP
Created July 23, 2015 15:28
List all existing custom post types in Wordpress.
<?php
/**
* Template Name: Custom Post Types List
*/
get_header();
$args=array(
'public' => true,
@Lukas238
Lukas238 / .md
Last active November 23, 2017 13:40
Multi-Environment Config Part for Wordpress

Multi-Environment Config Part for Wordpress

1. Include this code in the wp-config.php file.

/*
* 	Multi-Environment Config part for WordPress
*	By [email protected]
*
* Determines the current domain hosting, and calls
@Lukas238
Lukas238 / .js
Created August 5, 2015 23:10
Proper Error Handling in gulp.js
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var gutil = require('gulp-util');
var gulp_src = gulp.src;
gulp.src = function() {
return gulp_src.apply(gulp, arguments)
.pipe(plumber(function(error) {
// Output an error message
gutil.log(gutil.colors.red('Error (' + error.plugin + '): ' + error.message));
@Lukas238
Lukas238 / .js
Created August 5, 2015 23:25
gulp-plumber error handling 2
var plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
gutil = require('gulp-util');
var gulp_src = gulp.src;
gulp.src = function() {
return gulp_src.apply(gulp, arguments)
.pipe(plumber(function(error) {
@Lukas238
Lukas238 / .js
Created August 5, 2015 23:41
Better gulp-compass error handling with gulp-plumber and gulp-notify
var plumber = require('gulp-plumber'),
notify = require('gulp-notify');
var gulp_src = gulp.src;
gulp.src = function() {
return gulp_src.apply(gulp, arguments)
.pipe(plumber({ errorHandler: notify.onError({
title: "<%= error.plugin %>",
message: "<%= error.message %>"
})
@Lukas238
Lukas238 / .js
Created August 13, 2015 22:15
Get real width of window. The same as CSS media query.
function viewport() {
var e = window, a = 'inner';
if (!('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
//return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
return e[ a+'Width' ];
}
@Lukas238
Lukas238 / .md
Last active August 29, 2015 14:27
Convert mouse coordinate to cartecian (centered on parent div)

##jQuery: Convert mouse coordinate to cartecian (centered on parent div)

Demo

$('.canvas').on('click', function(e){
  var offset = $(this).offset();
    var x = (e.pageX - offset.left);
    var y = (e.pageY - offset.top);
@Lukas238
Lukas238 / .php
Created August 28, 2015 20:46
PHP+GD Watermark
<?php
function curPageURL() {
$pageURL = 'http';
if ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ) { $pageURL .= "s"; }
$pageURL .= "://";
$pageURL .= $_SERVER["SERVER_NAME"];
return $pageURL;
}
@Lukas238
Lukas238 / .html
Created August 29, 2015 00:31
NyanCat Post
<style>
body{background:#0f4d8f; overflow-x: hidden;}
#title, #main, #user{
background: none !important;
}
#title .content h1, #title .content h2{
text-shadow: none;
}
.nyan{
z-index:10;