Skip to content

Instantly share code, notes, and snippets.

View pasqualevitiello's full-sized avatar

Pasquale Vitiello pasqualevitiello

View GitHub Profile
@mehdichaouch
mehdichaouch / instagram-token-generator.php
Created October 20, 2019 22:48
Facebook / Instagram User Access Token Generator
<?php
/**
* Facebook / Instagram User Access Token Generator
*
* Documentation: https://developers.facebook.com/docs/instagram-basic-display-api
*
* With this code snippet not error like:
*
* {
* "error_type": "OAuthException",
@jsit
jsit / functions.php
Last active May 29, 2022 17:03
Customize WordPress comment form output
<?php
/**
* Rewrite the HTML for the author, email, and url comment fields
*/
function custom_comment_fields( $fields ) {
// https://codex.wordpress.org/Function_Reference/comment_form
$commenter = wp_get_current_commenter();
@jtsternberg
jtsternberg / cmb-select-with-optgroups.php
Last active November 15, 2017 20:38
CMB2 select field options overridden with a filter and using optgroups
<?php
function cmb_opt_groups( $args, $defaults, $field_object, $field_types_object ) {
// Only do this for the field we want (vs all select fields)
if ( '_cmb_option_field' != $field_types_object->_id() ) {
return $args;
}
$option_array = array(
'Group 1' => array(
@juliengdt
juliengdt / CHANGELOG.md
Last active September 5, 2023 09:27
CHANGELOG.md template

CHANGELOG.md

1.8.0 (unreleased)

Features:

  • add support for SVN sources -> 95f32s5b
  • add metadata allowed_push_host to new gem template -> 95f32s5b
  • adds a --no-install flag to bundle package -> 95f32s5b
@sdd
sdd / Module.js
Last active January 21, 2019 11:37
Javascript Module pattern template. Shows a class with a constructor and public/private methods/properties. Also shows compatibility with CommonJS(eg Node.JS) and AMD (eg requireJS) as well as in a browser.
/**
* Created with JetBrains PhpStorm.
* User: scotty
* Date: 28/08/2013
* Time: 19:39
*/
;(function(global){
"use strict";
var M = function() {
@georgebyte
georgebyte / background-color-picker.js
Last active September 13, 2020 20:13
jQuery: Background color picker (pick color from image by clicking on it)
var image = new Image();
image.src = "sample.jpg";
$(image).load(function() {
ctx.drawImage(image, 0, 0);
});
$(canvas).click(function(e) {
var canvasOffset = $(canvas).offset();
var canvasX = Math.floor(e.pageX-canvasOffset.left);
var canvasY = Math.floor(e.pageY-canvasOffset.top);