Skip to content

Instantly share code, notes, and snippets.

View eballeste's full-sized avatar
👁️‍🗨️
(-(-_(-_-)_-)-)

Enrique Ballesté Peralta eballeste

👁️‍🗨️
(-(-_(-_-)_-)-)
View GitHub Profile
//Copyright (c) 2020 BlenderNPR and contributors. MIT license.
#include "Pipelines/NPR_Pipeline.glsl"
uniform sampler1D color_gradient;
uniform vec4 line_color = vec4(0.0,0.0,0.0,1.0);
uniform float line_id_boundary_width = 1.0;
@monicao
monicao / react.md
Last active February 23, 2021 19:07
React Lifecycle Cheatsheet

React Component Lifecycle

  • getInitialState
  • getDefaultProps
  • componentWillMount
  • componentDidMount
  • shouldComponentUpdate (Update only)
  • componentWillUpdate (Update only)
  • componentWillReceiveProps (Update only)
  • render
@jonnymaceachern
jonnymaceachern / mobile-resize-check.js
Created September 4, 2015 14:29
A resize event is triggered when a mobile browsers address bar drops down (when changing directions in a scroll). This will let you check for only width resizes. From http://stackoverflow.com/questions/10750603/jquery-detect-a-window-width-change-but-not-a-height-change
var width = $(window).width();
$(window).resize(function(){
if($(this).width() != width){
width = $(this).width();
console.log(width);
// your code
}
});
<?php
/**
* Use * for origin
*/
add_action( 'rest_api_init', function() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' );
@addyosmani
addyosmani / package.json
Last active January 18, 2024 21:31
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
@banago
banago / infinite-previous-next-looping.php
Last active March 28, 2024 11:31
Infinite next and previous post looping in WordPress
<?php
/**
* Infinite next and previous post looping in WordPress
*/
if( get_adjacent_post(false, '', true) ) {
previous_post_link('%link', '&larr; Previous Post');
} else {
$first = new WP_Query('posts_per_page=1&order=DESC'); $first->the_post();
echo '<a href="' . get_permalink() . '">&larr; Previous Post</a>';
wp_reset_query();