Skip to content

Instantly share code, notes, and snippets.

View vicapow's full-sized avatar

Victor vicapow

View GitHub Profile
(async function() {
async function fetchData(date) {
var date_split = date.split('-'),
year = date_split[0],
month = date_split[1],
day = date_split[2];
if (parseInt(day) < 10){
day = parseInt(day);
}
month = parseInt(month) - 1;
@vicapow
vicapow / main.cpp
Created June 29, 2020 17:35
C++ rvalue reference and move semantics
#include <iostream>
#include <vector>
using namespace std;
struct A {
int * ptr;
A() {
cout << "Constructor" << endl;
ptr = new int;
@vicapow
vicapow / remove-lodash-es.js
Created March 6, 2020 21:46
convert lodash-es back to lodash
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
let body;
root.find(j.Program).map(program => {
body = program.value.body;
});
const lodashImports = root
@vicapow
vicapow / styled-components_v4.x.x.js
Created February 12, 2019 04:03
styled-components_v4.x.x.js
// @flow
declare module 'styled-components' {
// { type: '__styled' } is really only used ot avoid type collisions
// betwteen the interpolation unions types of (props: P) => string | number)
// and StyledComponent<any>.
declare export type StyledComponent<Props> = { type: '__styled' } & React$ComponentType<Props>;
declare export type Interpolation<P> =
| StyledComponent<any> // Order seems to matter unexpectedly.
@vicapow
vicapow / d3_v3.x.x.x.js
Created February 8, 2019 22:16
A d3 v3 Flow libdef
// @flow
declare module 'd3' {
declare module.exports: $Exports<'d3-es6-module'>;
}
declare module 'd3-es6-module' {
/**
* The current version of D3.js.
*/
// @flow
/* global process */
/* eslint-disable no-process-env */
const { execSync } = require('child_process');
const packageJson = require('../../package');
const execpath = process.env && process.env.npm_execpath;
if (execpath) {
if (!execpath.includes('yarn')) {
@vicapow
vicapow / feature-collection.json
Created October 24, 2017 22:37
Example GeoJSON that demonstrates the flicker/jagged issue in DeckGL
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vicapow
vicapow / geos-voronoi-in-js.c
Last active May 4, 2021 23:47
example of compiling geos to JS because why not
/*
To compile:
first, get a version of geos and put it in `geos` relative path. then...
cd geos
emconfigure ./configure
emmake make
cd ..
emcc \
-s EXPORTED_FUNCTIONS='["_get_voronoi"]' \
@vicapow
vicapow / example3-helloworld.s
Created December 31, 2016 21:38
'Hello world!' in x86_64 assembly without using any external libs.
## 'Hello world!' in x86_64 AT&T gas assembly in OS X.
## To assemble $> as -arch x86_64 example3-helloworld.s -o example3-helloworld.o
## To link: $> ld -arch x86_64 example3-helloworld.o -e _main -o example3-helloworld -lSystem
.section __TEXT,__text
.macosx_version_min 10, 12
.globl _main
_main:
movq $0x2000004, %rax # write (system call $4 with $0x2000000 offset)
movq $1, %rdi # write to stdout (fid 1)
leaq L_.str(%rip), %rsi # set the register address of the start of the string
@vicapow
vicapow / react-map-gl-tasks.md
Last active December 11, 2015 02:13
What needs love in react-map-gl "ecosystem" #buzzwords

Let me know if you have any questions or need clarification! Any questions you have will help us shape the library and/or fix the docs :P

Style diffing is (sometimes) broken in the precense of refs

Make resizing syncronous (instead of async)

better documentation - visgl/react-map-gl#22