Skip to content

Instantly share code, notes, and snippets.

View ccurtin's full-sized avatar
🤙
makka thangs

Christopher James Curtin ccurtin

🤙
makka thangs
View GitHub Profile
@ccurtin
ccurtin / automatically-fill-and-sort-grid-rows-from-sizes-according-to-a-maxrowsum.markdown
Created March 21, 2022 01:21
Automatically Fill and Sort Grid Rows From Sizes According to a maxRowSum
@ccurtin
ccurtin / tokenPriceApi.js
Created November 17, 2021 12:46 — forked from Linch1/tokenPriceApi.js
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"interna
input Deviation_Length = 60;
input Deviate = 2;
input high_price = high;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;
def belowdev = volumestdev <= Deviate;

def volumereplace = volume;
def increase = volume &gt; volume[1];
@ccurtin
ccurtin / Animated Canvas Gradient Background.jsx
Created December 17, 2020 19:45
Animated Canvas Gradient Background
const animatedCanvasGradient = () => {
useEffect(() => {
animateCanvas('canvas')
}, [])
return (
<canvas
id="canvas"
width="26"
height="26"
style={{
@ccurtin
ccurtin / COPYING OVER WOOCOMMERCE PRODUCT CATEGORY IMAGES FROM A SOURCE TO TARGET SERVER.md
Created November 20, 2020 17:12
COPYING OVER WOOCOMMERCE PRODUCT CATEGORY IMAGES FROM A SOURCE TO TARGET SERVER

COPYING OVER WOOCOMMERCE PRODUCT CATEGORY IMAGES FROM A SOURCE TO TARGET SERVER

  • wp_posts

  • wp_postmeta

  • wp_termmeta

    --- EXPORT the product cat image "post ids" (used for the rest of the import/)
    --- note: `meta_value` contains the wp_posts post IDs we will be using
    SELECT meta_value FROM wp_termmeta INNER JOIN wp_term_taxonomy ON wp_termmeta.term_id = wp_term_taxonomy.term_id WHERE wp_termmeta.meta_key LIKE 'thumbnail_id' AND wp_term_taxonomy.taxonomy LIKE 'product_cat';
@ccurtin
ccurtin / get-a-users-public-ip-address.js
Last active August 17, 2020 21:41
Get User's Public IP Address
// FREE: no request linit for ipify.org
var request = new XMLHttpRequest()
var ipAddress = ''
request.open('GET', "https://api.ipify.org?format=jsonp=", true)
var ipAddress = request.onload = function() {
if (request.status >= 200 && request.status < 400) {
// Success!
return ipAddress = request.responseText
} else {
// We reached our target server, but it returned an error
@ccurtin
ccurtin / Detect-if-IE.js
Created November 23, 2015 06:41
Detect if IE and add class to html/body..
/**
* detect IE
* returns version of IE or false, if browser is not Internet Explorer
*/
(function detectIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if (msie > 0) {
@ccurtin
ccurtin / js-currying-example.js
Created April 25, 2020 03:46
JS Currying Example
function curry(func) {
return function curried(...args) {
if (args.length >= func.length) {
return func.apply(this, args);
} else {
return function(...args2) {
return curried.apply(this, args.concat(args2));
}
}
}
@ccurtin
ccurtin / hm_get_template_part.php
Created January 26, 2020 22:25
Same as include_template_part, require, include, but allows for arguments to be passed into template file.
<?php
/**
* Like get_template_part() put lets you pass args to the template file
* Args are available in the tempalte as $template_args array
* @param string filepart
* @param mixed wp_args style argument list
* @example hm_get_template_part( 'template_path', [ 'option' => 'value' ] ); ---> then in template: $template_args['option'];
*/
function hm_get_template_part( $file, $template_args = array(), $cache_args = array() ) {
@ccurtin
ccurtin / blobToJSONObject.js
Created January 15, 2020 23:58
Converts Blob Objects to JSON objects, creating accessible Object keys from Blob properties
BlobToJSONObject = (blob) => {
obj = {}
for (var prop in blob) {
obj[prop] = blob[prop]
}
return obj
}