Skip to content

Instantly share code, notes, and snippets.

View punksta's full-sized avatar
🎯
Focusing

Stas Shakirov punksta

🎯
Focusing
  • humy.ai
  • Stockholm, Sweden
View GitHub Profile
@punksta
punksta / DraggingFalling.js
Created August 20, 2018 09:23
falling animation + dran-n-drop
import * as React from "react";
import {Animated, PanResponder, Dimensions} from "react-native";
import AnimatedValueXY from "react-native/Libraries/Animated/src/nodes/AnimatedValueXY";
import {onlyUpdateForKeys} from "recompose";
import type {CompositeAnimation} from "react-native/Libraries/Animated/src/AnimatedImplementation";
import {consoleTime, consoleTimeEnd} from "../utils/debugUtils";
class DraggingFalling extends React.Component {
@punksta
punksta / keybase.md
Created June 29, 2018 09:13
keybase key proof

Keybase proof

I hereby claim:

  • I am punksta on github.
  • I am punksta (https://keybase.io/punksta) on keybase.
  • I have a public key whose fingerprint is 0700 466C 1F23 75B7 ADDB 436E 002C D2F5 8327 F651

To claim this, I am signing this object:

@punksta
punksta / privacy.txt
Last active November 30, 2017 10:06
RoboPoetry files
The app `RoboPoetry` does not collect or store user data on it's side.
App use yandexspeech sdk speech engine. Yandex can collect some user data.
30 nov 2017
@punksta
punksta / create_backup.sh
Created July 16, 2017 21:52
Create gpg encrypted tag.gz arhive
keyId="email or key id"
#prefix of output file
prefix="mybackup"
#current date current time
now=`date +"%m_%d_%Y_%T"`
path=$1
outputDir=$2
tarFile="$outputDir/${prefix}_${now}.tar.gz"
@punksta
punksta / SendingImagesResult.kt
Created April 8, 2017 18:19
Providing a delegate kotlin 1.1
class MyActivity : AppCompatActivity() {
private val d: TextView by findRes(R.id.action_bar)
}
class ResourceLoader<out V>(val id: Int) {
private var cache : V? = null
private var rootView: View? = null
@punksta
punksta / ErrorApiDecorator.kt
Created March 23, 2017 09:17
error catching decorator for retrofit instance
import rx.Observable
import rx.Single
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Method
import java.lang.reflect.Proxy
/**
* Created by punksta on 18.10.16.
*/
object ErrorApiDecorator : IApiDecorator {
@punksta
punksta / integration.hs
Created September 18, 2016 18:53
integral method on haskell
module Main where
-- Реализуйте функцию, находящую значение определённого интеграла от заданной функции f на заданном интервале [a,b]
--
-- методом трапеций. (Используйте равномерную сетку; достаточно 1000 элементарных отрезков.)
--
-- integration :: (Double -> Double) -> Double -> Double -> Double
-- integration f a b = undefined
--
@punksta
punksta / fibonacci by accumulators
Created September 17, 2016 21:49
fibonacci recursion with accumulators
fibonacci :: Integer -> Integer
fibonacci 0 = 0
fibonacci n | n > 0 = fibInner n 1 1
| n < 0 = fibInner n 1 1
fibInner :: Integer -> Integer -> Integer -> Integer
fibInner (-1) r r2 = r
fibInner 1 r r2 = r
fibInner n r r2 | n > 0 = helper (n - 1) r2 (r + r2)
| n < 0 = - helper (n + 1) r2 (r + r2)
@punksta
punksta / cert_from_provission.rb
Last active July 3, 2016 07:13
Ruby function returns public key certificate from iOS provision profile. Returns OpenSSL::X509::Certificate object.
require 'openssl'
require 'open3'
require 'plist'
PROVISIONS = "#{Dir.home}/Library/MobileDevice/Provisioning\ Profiles/".freeze
def get_cert(uuid)
path = File.join PROVISIONS, "#{uuid}.mobileprovision"
o, e, s = Open3.capture3("security cms -D -i '#{path}'")
if s.exitstatus != 0
raise "Can't extract plist from provision profile\n" + e