Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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

Ali Najafizadeh alinz

🎯
¯\_(ツ)_/¯
View GitHub Profile
// @flow
import React, { Component } from 'react'
import { Image, Animated, View } from 'react-native'
type ProgressiveImageState = {
thumbnailOpacity: number,
key: string
}
@alinz
alinz / Makefile
Created September 25, 2019 19:26
Compile Zig to WebAssembly and run it in Node.js
build:
zig build-exe --name test.wasm -target wasm32-freestanding --release-small test.zig
@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(
@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 / react-native-notifications+3.3.4.patch
Last active December 17, 2020 17:53
A react-native-notifications patch for getting scheduled local notification working in Android
diff --git a/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java b/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java
index f9c858b..94ea188 100644
--- a/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java
+++ b/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java
@@ -2,8 +2,8 @@
package com.wix.reactnativenotifications;
import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.v4.app.NotificationManagerCompat;
type Claims struct {
AccountID string `json:"account_id"`
GroupID string `json:"group_id"`
jwtgo.StandardClaims
}
// Encode
func (c *Claims) Encode(secretKey []byte) (string, error) {
const op = errors.Op("jwt.Claims.Encode")
package config
import (
"os"
"strings"
"github.com/spf13/viper"
)
type Config struct {
@alinz
alinz / Certificates.go
Created November 12, 2019 05:29 — forked from Mattemagikern/Certificates.go
Create x509 certificate chain using Golang. Root CA, Designated CA, server CA
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
@alinz
alinz / sample.sh
Created November 12, 2019 00:13
OPENSSL encrypt decrypt
openssl aes-256-cbc -in plain.txt -out plain.enc -k cool
openssl aes-256-cbc -d -in plain.enc -out plain.txt -k cool
@alinz
alinz / PROFILE.MD
Created November 7, 2019 17:24
Golang Profiling commands

Prfile

Generate Prfile data

go test -cpuprofile cpu.prof -memprofile mem.prof -bench .

Visual Profile data