Skip to content

Instantly share code, notes, and snippets.

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

Kishore Chandra Sahoo kish2011

🏠
Working from home
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active June 1, 2024 16:50
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
/**
* WordPress dependencies
*/
import { createPortal, useEffect, useState } from '@wordpress/element';
import { registerPlugin } from '@wordpress/plugins';
import { Button } from '@wordpress/components';
function MyToolbarButton() {
// Lazy and one time initializations, also gives us a stable reference.
const [ container ] = useState( () => {
@DragonBe
DragonBe / php_apache_homebrew.md
Last active November 20, 2022 18:15
Installation of Apache 2.4 and PHP 7.1 with Homebrew

I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install.

The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands.

I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial.

Apache and PHP with homebrew

I’ve made this according to the installation instructions given on GetGrav.

@cliffordp
cliffordp / functions.php
Last active September 26, 2017 20:32
Event Tickets Plus and WooCommerce: Set child input based on forced quantity sync with parent input.
<?php
/**
* Event Tickets Plus and WooCommerce:
* Set child input based on forced quantity sync with parent input.
*
* You need to edit the product IDs (1129 parent and 1128 child in this example code)
*
* From https://gist.github.com/cliffordp/5a769159a2bf64f0b1b1dbbde243d109
* GIF preview: https://cl.ly/1F1N0h211b1w
*
@jwebcat
jwebcat / ngrok-installation.md
Created December 23, 2015 06:58 — forked from wosephjeber/ngrok-installation.md
Installing ngrok on Mac

#Installing ngrok on OSX

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
@snnwolf
snnwolf / gist:d22501563210e42f720f
Created November 3, 2015 21:21
MacPorts (PHP, MySQL, SQLite, Postgres)

Install Apache 2, MySQL 5 and PHP 5 on Mac OS X using MacPorts:

Preparation

  • Install Xcode: Grab it from App Store
  • Install Command line tools in xcode (open xcode -> Preferences -> Downloads -> Command Line tools)
  • Install MacPorts: http://macports.org/install.php.
  • Check MacPorts is installed. This will be a good test to see if MacPorts was installed properly:sudo port -v selfupdate.

If you're interested in how MacPorts works, consider reading the documentation for it here: http://guide.macports.org/.

@ultimatemember
ultimatemember / gist:643cd90967e5e415378d
Last active June 20, 2020 21:32
Custom profile tab example: showing user pages
/* add a custom tab to show user pages */
add_filter('um_profile_tabs', 'pages_tab', 1000 );
function pages_tab( $tabs ) {
$tabs['pages'] = array(
'name' => 'Pages',
'icon' => 'um-faicon-pencil',
'custom' => true
);
return $tabs;
}
@ultimatemember
ultimatemember / gist:afb94c5b66c63a34d3c1
Last active November 5, 2015 19:07
UM/EDD Open Metrics: Show recent payments
// recent payments
function sc_edd_recent_payments( $atts ) {
$p_query = new EDD_Payments_Query( array(
'number' => 12,
'status' => 'publish'
) );
$payments = $p_query->get_payments();
@nitingupta910
nitingupta910 / main.c
Last active July 15, 2023 02:58 — forked from crosbymichael/main.c
rocksdb C example
/*
Makefile:
(make sure Makefile is indented using a tab and not spaces)
all:
cc -Wall -g -O0 rdb_mergeop.c -o rdb_mergeop -lstdc++ -lrocksdb -lsnappy -lbz2 -llz4 -lz
clean:
rm -rf rdb_mergeop
rm -rf testdb
*/
@zoerooney
zoerooney / jquery.js
Last active August 15, 2023 02:21
Shopify minicart on non-Shopify site
<script>
jQuery.ajax({
type: 'GET',
url: 'http://mysite.myshopify.com/cart.json',
dataType: 'jsonp',
success: function(data) {
var item_count = data['item_count'];
var total_price = data['total_price']/100;
//If there are items in cart