Skip to content

Instantly share code, notes, and snippets.

View gregogalante's full-sized avatar
✌️
What's happening?

Gregorio Galante gregogalante

✌️
What's happening?
View GitHub Profile
@bolderelements
bolderelements / hide-payment-based-on-shipping.php
Last active February 19, 2018 20:43
Hide Payment Gateway Based on Shipping Option Selected
/**
* Hide the PayPal payment option when the customer selects a specific Table Rate option
* Code snippets should be added to the functions.php file of your child theme
*
* @return array
*/
function alter_payment_gateways( $list ){
// Retrieve chosen shipping options from all possible packages
$chosen_rates = ( isset( WC()->session ) ) ? WC()->session->get( 'chosen_shipping_methods' ) : array();
@yacafx
yacafx / default
Last active February 9, 2023 20:07
NGNIX configuration for run node app and php app at the same same time - This configuration made Node and Wordpress working at the same time on two different routes.
### /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.php;
@BadAllOff
BadAllOff / gist:06bbce913365363829e577c50d7980f0
Created June 18, 2017 09:29 — forked from WizardOfOgz/gist:1012107
Save Base64-encoded images with Paperclip
class Avatar < ActiveRecord::Base
attr_accessor :content_type, :original_filename, :image_data
before_save :decode_base64_image
has_attached_file :image,
PAPERCLIP_CONFIG.merge(
:styles => {
:thumb => '32x32#',
:medium => '64x64#',
@emcmanus
emcmanus / snakeToCamelCase.js
Last active May 17, 2022 02:29 — forked from felixjung/snakeToCamelCase.js
ES6 module to recursively convert snake case keys in an object to camel case using lodash.
'use strict';
/**
* @example
* import keysToCamelCase from './snakeToCamelCase';
* keysToCamelCase({bad_key: 1}); => {badKey: 1}
* keysToCamelCase([{bad_key: 1}]); => [{badKey: 1}]
*/
function keysToCamelCase(object) {
@igorbenic
igorbenic / hook.php
Created January 26, 2017 12:31
WooCommerce Stock Management with other Services | http://www.ibenic.com/woocommerce-stock-management-services
<?php
// woocommerce/includes/abstracts/abstract-wc-product.php
/**
* Returns number of items available for sale.
*
* @return int
*/
public function get_stock_quantity() {
@0x263b
0x263b / colors.md
Last active March 7, 2024 10:09
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@jarretmoses
jarretmoses / React Native Clear Cache
Last active March 11, 2024 10:20
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
package com.yourapp.navbar;
import android.app.Activity;
import android.view.View;
import com.facebook.react.ReactActivity;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
@esamattis
esamattis / WebViewAutoHeight.js
Last active February 11, 2022 16:01
React native: Is it possible to have the height of a html content in a webview? http://stackoverflow.com/q/32952270
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Esa-Matti Suuronen <esa-matti@suuronen.org>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@maxivak
maxivak / readme.md
Last active January 12, 2024 06:53
Integrating Gem/Engine and Main Rails App