Skip to content

Instantly share code, notes, and snippets.

View alinz's full-sized avatar
🎯
¯\_(ツ)_/¯

Ali Najafizadeh alinz

🎯
¯\_(ツ)_/¯
View GitHub Profile
@alinz
alinz / keybase.md
Created February 7, 2015 00:14
Keybase proof

Keybase proof

I hereby claim:

  • I am alinz on github.
  • I am alinz (https://keybase.io/alinz) on keybase.
  • I have a public key whose fingerprint is BDCE 86EA 7281 9C1E 6A4F F16E E75A 6615 3818 E8C6

To claim this, I am signing this object:

const fp_delta = () => {
let p = null;
return (v) => {
const t = p == null ? v : p;
p = v;
return v - t;
};
};
const fp_min = (min) => (v) => v < min? min : v;
@alinz
alinz / version-update.sh
Created March 18, 2016 18:20
Simple bash script to update your react-native version.
#!/bin/bash
usage ()
{
echo "Version Update"
echo ""
echo "Usage:"
echo ""
echo " Options:"
echo " -h show usage/help"
@alinz
alinz / refactor-to-react-native-25.js
Created May 9, 2016 21:51
Sample codemod transformation to refactor react-native < 25 to react-native 25
export default function transformer(file, api, options) {
const j = api.jscodeshift;
const printOptions = options.printOptions || {quote: 'single'};
const root = j(file.source);
const reactImport = () => {
return j.importDeclaration(
[
j.importDefaultSpecifier(
// @flow
import React, { Component } from 'react'
import { Image, Animated, View } from 'react-native'
type ProgressiveImageState = {
thumbnailOpacity: number,
key: string
}
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTScrollView.h"
@alinz
alinz / certbot.md
Last active May 11, 2017 01:35
creating let's encrypt certificate using docker and certbot standalone
docker run -it --rm -p 443:443 -p 80:80 --name certbot -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" certbot/certbot certonly
@alinz
alinz / dep.js
Last active November 16, 2017 20:02
Dependency Tracker for your app using babel
// @flow
// make sure to install `yarn add babel-preset-stage-0`
const fs = require('fs')
const path = require('path')
const { transform } = require('babel-core')
const walker = (inputPath, extension, list = []) => {
if (fs.statSync(inputPath).isFile()) {
@alinz
alinz / Dockerfile
Last active June 15, 2021 14:47
Postgress in Docker
FROM postgres:10.0-alpine
COPY create-multiple-postgresql-databases.sh /docker-entrypoint-initdb.d/
# COPY ./goose /bin/goose
@alinz
alinz / gundb-stresstest.js
Created December 5, 2017 17:03
Gundb Stress Test
const stream = require('stream')
const Gun = require('gun')
const randomString = length => {
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
let text = ''
for (var i = 0; i < length; i++) {
text += possible[Math.floor(Math.random() * possible.length)]
}
return text