Skip to content

Instantly share code, notes, and snippets.

View digitalhydra's full-sized avatar
💭
please don't turn this into The MS social network

Jairo Mejia digitalhydra

💭
please don't turn this into The MS social network
View GitHub Profile
@digitalhydra
digitalhydra / ssh-init.sh
Created January 9, 2024 04:45 — forked from qtfkwk/ssh-init.sh
Start SSH agent and/or add keys (add to your .bashrc or .zshrc)
# Start the SSH agent (not needed if desktop environment starts it)
SSH_ENV="$HOME/.ssh/agent"
function start_agent {
MASK=$(umask)
umask 0077
/usr/bin/ssh-agent |sed 's/^echo/#echo/' >"${SSH_ENV}"
umask $MASK
. "${SSH_ENV}" >/dev/null
}
@digitalhydra
digitalhydra / arch-missing-keyring.md
Created February 11, 2022 16:14 — forked from puncoz/arch-missing-keyring.md
Arch Linux: missing keyring issue on updates

error: key "CEB167EFB5722BD6" could not be looked up remotely error: required key missing from keyring error: failed to commit transaction (unexpected error)

$ sudo pacman-key --lsign-key CEB167EFB5722BD6

if this gives error ERROR: CEB167EFB5722BD6 could not be locally signed.

$ sudo pacman-key --refresh-keys

curl -L -u $BB_USER:$BB_PASS https://bitbucket.org/api/2.0/repositories/[org]/[repo-name]/pullrequests/[pr-number]/diff | git apply
@digitalhydra
digitalhydra / HashTable.js
Created June 7, 2017 00:50 — forked from alexhawkins/HashTable.js
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@digitalhydra
digitalhydra / functions.php
Created March 25, 2017 05:16 — forked from kloon/functions.php
WooCommerce 2.1 Add confirm password option at checkout
<?php
// place the following code in your theme's functions.php file
// Add a second password field to the checkout page.
add_action( 'woocommerce_checkout_init', 'wc_add_confirm_password_checkout', 10, 1 );
function wc_add_confirm_password_checkout( $checkout ) {
if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) {
$checkout->checkout_fields['account']['account_password2'] = array(
'type' => 'password',
'label' => __( 'Confirm password', 'woocommerce' ),
'required' => true,
@digitalhydra
digitalhydra / gist:b745f7d1ad730ff5f8a814edec0fe2af
Created September 13, 2016 16:28 — forked from mikejolley/gist:3b37b9cc19a774665f31
Example instance based shipping method
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Sample instance based method.
*/
class WC_Shipping_Test_Method extends WC_Shipping_Method {
@digitalhydra
digitalhydra / paises-iso.php
Last active August 30, 2016 01:21 — forked from vxnick/gist:380904
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@digitalhydra
digitalhydra / example-wp-list-table.php
Created August 8, 2016 03:15 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
var uuids = angular.module('uuids', []);
uuids.factory("rfc4122", function () {
return {
newuuid: function () {
// http://www.ietf.org/rfc/rfc4122.txt
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
@digitalhydra
digitalhydra / introrx.md
Last active August 29, 2015 14:18 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.