Skip to content

Instantly share code, notes, and snippets.

View DahmaniAdame's full-sized avatar

Adame Dahmani DahmaniAdame

View GitHub Profile
@thisbit
thisbit / googleSheetsEndpoint.js
Created July 15, 2023 07:51
Google Sheets as JSON, use this with Extensions > App Script in google sheets
function getSheetDataAsJSON() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getDataRange();
var values = range.getValues();
var headers = values[0];
var jsonData = [];
for (var i = 1; i < values.length; i++) {
var row = values[i];
var rowObj = {};
@rainbat
rainbat / Commit Active Snippet
Last active November 3, 2022 05:49
This Snippet will be called from the Admin Bar and commit the currently selected snippet to GitHub
<?php
function commitsnippet_admin_bar_button($wp_admin_bar){
$args = [
"id" => "custom-button-commitsnippet",
"title" => "Commit Active Snippet",
"href" => "#",
"meta" => [
"class" => "custom-button-class",
"onclick" => "commitSnippet()"
@pacotole
pacotole / creame-optimize.php
Last active October 31, 2024 21:15
WordPress must-use plugin with site optimizations
<?php
/*
Plugin Name: Creame Optimize
Plugin URI: https://crea.me/
Description: Optimizaciones de Creame para mejorar tu <em>site</em>.
Version: 2.1.5
Author: Creame
Author URI: https://crea.me/
License: MIT License
*/
@juliquiron
juliquiron / class-plugin-disabler.php
Created November 22, 2019 13:15
Disable plugins in specific URLs in Wordpress
<?php
/**
* Plugin disabler for specific URLs
*
* @package Timeular
* @author Julià Mestieri
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@herrbischoff
herrbischoff / pagerank.php
Last active August 29, 2015 14:19
Output Google Pagerank
<?php
function genhash ($url) {
$hash = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer.";
$c = 16909125;
$length = strlen($url);
$hashpieces = str_split($hash);
$urlpieces = str_split($url);
for ($d = 0; $d < $length; $d++) {
$c = $c ^ (ord($hashpieces[$d]) ^ ord($urlpieces[$d]));
@tjstein
tjstein / nginx-vhost.conf
Created April 5, 2011 00:47
nginx vhost config for WordPress + PHP-FPM
upstream php-fpm {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name www.example.com;
rewrite ^ http://example.com$request_uri?;
}