Skip to content

Instantly share code, notes, and snippets.

View marcoslhc's full-sized avatar
🏳️‍🌈
He's like the rainbow

Marcos Hernández marcoslhc

🏳️‍🌈
He's like the rainbow
View GitHub Profile
@marcoslhc
marcoslhc / export-fastlane-match.rb
Created February 23, 2024 16:18 — forked from sbycrosz/export-fastlane-match.rb
Export fastlane match signing credentials for AppCenter
# Export iOS code signing as p12 and mobileprovision file for usage in Appcenter
# Manual decryption as described on https://docs.fastlane.tools/actions/match/
desc "Export fastlane match signing credentials for AppCenter"
lane :export_code_signing do
ensure_env_vars(
env_vars: [
"MATCH_GIT_URL",
"MATCH_PASSWORD",
]
@marcoslhc
marcoslhc / token.php
Created July 29, 2020 23:03 — forked from patrickbussmann/token.php
Sign in with Apple - PHP
<?php
# composer require web-token/jwt-framework
require_once 'vendor/autoload.php';
use Jose\Component\Core\AlgorithmManager;
use Jose\Component\KeyManagement\JWKFactory;
use Jose\Component\Signature\Algorithm\ES256;
use Jose\Component\Signature\JWSBuilder;
use Jose\Component\Signature\Serializer\CompactSerializer;
@marcoslhc
marcoslhc / CurlLoggingInterceptor.java
Created July 6, 2018 20:58 — forked from jgilfelt/CurlLoggingInterceptor.java
An OkHttp interceptor that logs requests as curl shell commands
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@marcoslhc
marcoslhc / reduxSelectorPattern.md
Created December 22, 2017 04:15 — forked from abhiaiyer91/reduxSelectorPattern.md
Redux Selector Pattern

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default:
@marcoslhc
marcoslhc / axios-instance-config.js
Created July 8, 2017 12:48 — forked from ccnokes/axios-instance-config.js
Good default configuration for axios in node.js
const axios = require('axios');
const http = require('http');
const https = require('https');
module.exports = axios.create({
//60 sec timeout
timeout: 60000,
//keepAlive pools and reuses TCP connections, so it's faster
httpAgent: new http.Agent({ keepAlive: true }),
@marcoslhc
marcoslhc / slim-redux.js
Created February 7, 2017 03:06 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@marcoslhc
marcoslhc / adt.js
Created January 14, 2017 02:20 — forked from yelouafi/adt.js
Algebraic Data Types in javascript (see http://tech.pro/blog/6885/javascript-and-type-thinking)
function eachKey(obj, f) {
for(var key in obj) {
if( obj.hasOwnProperty(key) )
f(key, obj[key]);
}
}
function adtcase (base, proto, key) {
return (...args) => {
var inst = new base();
var sprintf = function (str) {
var args = Array.prototype.slice.call(arguments, 1),
hash = {
'%s': String,
'%d': parseInt,
'%f': parseFloat
};
return str.replace(/%0(\d+)d/g, function (m, num) {
var r = String(args.shift()),
c = '';
@marcoslhc
marcoslhc / mp3.js
Last active July 30, 2016 22:06 — forked from dtrce/mp3.js
streaming mp3 using nodejs
var http = require('http'),
fileSystem = require('fs'),
path = require('path'),
util = require('util');
http.createServer(function(request, response) {
var filePath = request.url.split('').slice(1).join('');
var stat = fileSystem.statSync(filePath);
response.writeHead(200, {
@marcoslhc
marcoslhc / tmux.md
Created January 31, 2016 17:29 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a