Skip to content

Instantly share code, notes, and snippets.

View Schniz's full-sized avatar

Gal Schlezinger Schniz

View GitHub Profile
@Schniz
Schniz / bcrypt_v2.0.0__flow_v0.69.0.js
Created April 9, 2018 21:49
opaque types for bcrypt
opaque type bcrypt$hashed = string;
declare module "bcrypt" {
declare module.exports: {
hash: (password: string, saltRounds: number) => Promise<bcrypt$hashed>,
compare: (
password: string,
hashedPassword: bcrypt$hashed
) => Promise<boolean>,
};

Keybase proof

I hereby claim:

  • I am schniz on github.
  • I am schniz (https://keybase.io/schniz) on keybase.
  • I have a public key ASAoK6wufz1Xfrm7AFF4Sbb1_pj9uagkBzRY1crIXWYI3go

To claim this, I am signing this object:

@Schniz
Schniz / jira.1m.sh
Created August 17, 2017 13:43
Jira BitBar
#!/bin/bash
#
# Install `jq` by `brew install jq`
# Make sure to have ~/dotfiles/bitbar/.env with the following env vars:
# JIRA_USERNAME=...
# JIRA_PASSWORD=...
# JIRA_BASE_URL=https://something.atlassian.net
#
@Schniz
Schniz / curry.py
Created August 14, 2017 14:05
Curry python decorator
#!/usr/bin/env python
def curry(fn):
arg_count = fn.func_code.co_argcount
def start(*initial_args):
args = []
args.extend(initial_args)
def inner(*more_args):
@Schniz
Schniz / GetCurrentLocation.jsx
Created June 25, 2017 20:46
React Native component for getting the current location. for lazy ones like me.
import React from "react";
export default class GetCurrentLocation extends React.Component {
state = {};
watchId = null;
componentDidMount() {
const options = {
enableHighAccuracy: true,
timeout: 200,
@Schniz
Schniz / buildSingleLineString.js
Last active April 8, 2018 02:00
build a single-line string by trimming a multiline string
const buildSingleLineString = (strings, ...vals) => {
const stringsWithoutSpaces = strings.map(multipleLines =>
multipleLines.split('\n').map(line =>
line.trim()
).join('')
)
return String.raw({ raw: stringsWithoutSpaces }, ...vals)
}
const url = buildSingleLineString`
import React from 'react';
import {Image, StyleSheet, TouchableOpacity, Dimensions, View, Animated, PanResponder, Text} from 'react-native';
import { Constants, BlurView } from 'expo';
class ReachNavigationDemo extends React.Component {
state = { isClosed: true, scroll: new Animated.Value(0) }
position = 0;
panResponder = PanResponder.create({
onMoveShouldSetResponderCapture: () => true,
onMoveShouldSetPanResponderCapture: (_, { dy }) => Math.abs(dy) > 0.5,
@Schniz
Schniz / profile.fish
Created June 5, 2017 20:51
remind_me to create this gist tomorrow at 12pm 🙌🏻
function remind_me
osascript ~/dotfiles/applescripts/remind_me.scpt "$argv"
end
exports default navigation => class NavigationOptions extends Component {
componentDidMount() {
this.setParams(this.props)
}
componentWillReceiveProps(nextProps) {
this.setParams(nextProps)
}
setParams = (navigationOptions) => {
@Schniz
Schniz / sendRoute.js
Created April 1, 2017 22:54
sendRoute.js
const sendRoute = (texts, ...args) => {
return (req, res) => {
const evaluatedArgs = args.map(arg => {
if (typeof arg === 'function') {
return arg(req)
}
return arg
})