Skip to content

Instantly share code, notes, and snippets.

View MarcoPolo's full-sized avatar
🌠
Gradatim

Marco Munizaga MarcoPolo

🌠
Gradatim
View GitHub Profile

Interacting with Go from React Native through JSI

Introduction

There are 3 parts that let JS talk to Go:

  1. The C++ binding
  2. Installing the binding
  3. Calling Go
@MarcoPolo
MarcoPolo / prop-enumerations.js
Created February 11, 2019 19:06
Enumerate through props quickly
function seedPossibilitiesCount(seed) {
if (Array.isArray(seed)) {
return seed.length
} else if (typeof seed === 'object' && !!seed && seed.constructor === Object) {
let count = 1
Object.keys(seed).forEach(k => {
count *= seedPossibilitiesCount(seed[k])
})
return count
}
var http = require('http')
var fs = require('fs')
var server = http.createServer(function(request, response) {
var req = request
response.writeHead(200, {'Content-Type': 'textplain'})
if (req.method === 'POST') {
var body = ''
req.on('data', function(data) {
body += data
})
@MarcoPolo
MarcoPolo / Bubbles they bounce
Created September 25, 2012 04:31
Bubble sort in freaking asm
;****************************************************************************************
; file = ex0.asm
; Quick examples of Assembler directives & 28F335 DSP code
; Dr. Karl Gugel, May/2009
;
; To be assembled using Code Composer Studio which requires a linker command
; file to tell CCR where to place code & data into DSP SRAM.
; The command file used = 28335_RAM_lnk.com
; Important Code locations:
; .text RAML1 (internal DSP memory) starting address = 09000 Hex, 4K Words
@MarcoPolo
MarcoPolo / gist:db5ffb4ca5f14d42d5f242a6af0b2524
Last active November 10, 2016 05:12
Traverse inverse dependency react native
counts = {}
a = {} // your inverse dep map
// helper to return a string of n spaces... omg this is left pad
function s (n) { let k = ''; for (i = 0; i<n; i++) {k = k + ' '}; return k}
function f (k, ttl, indent, seen) {
if (seen[k]) { console.warn('circular dep found', k, seen) }
let kl = (''+k).length; counts[k] = (counts[k] || 0) + 1 ;return (ttl > 0 && a[k] && a[k].length ? k + ' -> ' + a[k].map(i => f(i, ttl - 1, indent + s(4+kl), Object.assign(seen, {[k]: true}))).join('\n' + s(kl + 4) + indent) : k)
}
" vim: ts=4 sw=4 et
function! neomake#makers#ft#rust#EnabledMakers()
return ['rustc']
endfunction
function! neomake#makers#ft#rust#rustc()
return {
\ 'args': ['rustc', '-Zno-trans'],
\ 'exe': 'cargo',
{:+ {:app {
"pmeta-alt-j" [:dev-inspector]
}}
@MarcoPolo
MarcoPolo / gist:8481413
Created January 17, 2014 21:00
Terminator, soft tango. A soft dark color scheme very loosely based of tango
palette = "#1b1b1b:#ab4642:#a0b56c:#f7ca87:#7cafc2:#ba8baf:#86c1b8:#cfcfcf:#dc9656:#e85f59:#cde88b:#ffe5bd:#91cde3:#e1a8d3:#9ce1d6:#f7f7f7"
@MarcoPolo
MarcoPolo / gist:8461947
Created January 16, 2014 19:42
How to write inline stuff
(cmd/command {:command ::trigger-inline
:desc "triggers lt-tmux inline"
:exec (fn []
(object/raise lt-tmux ::show-inline {:result "stay classy"}) )})
@MarcoPolo
MarcoPolo / gist:8216536
Created January 2, 2014 08:51
SOCKS proxy on a plain connection
(def ^:dynamic *socks-proxy* (InetSocketAddress. "localhost" 8118))
(def PlainSocksSocketFactory
(proxy
[PlainSocketFactory] []
(createSocket [params]
(Socket. (Proxy. Proxy$Type/SOCKS *socks-proxy*)))))
(def reg
(doto