Skip to content

Instantly share code, notes, and snippets.

View k06a's full-sized avatar
🚀
DeFi dreamer

Anton Bukov k06a

🚀
DeFi dreamer
View GitHub Profile
@vdugnist
vdugnist / check-categories-compiled.rb
Last active April 13, 2018 22:36
Check that imported category exists in targets compile source.
require 'xcodeproj'
require 'set'
SOURCE_FOLDER=ARGV[0] ? ARGV[0] : ENV['PROJECT_DIR']
PROJECT_PATH=ARGV[1] ? ARGV[1] : ENV['PROJECT_FILE_PATH']
if !SOURCE_FOLDER || !PROJECT_PATH then
puts "usage: ruby check-categories_compiled.rb source_folder project_path"
exit 1
end
@ilyapuchka
ilyapuchka / StyleProxy.swift
Last active May 19, 2020 20:14
Adaptive Font styles
public protocol Stylish: class {
func updateStyle()
}
public class StyleProxy<S: Stylish>: NSObject {
fileprivate override init() { }
}
private class StyleProxyView<S: Stylish>: UIView {
@floriankraft
floriankraft / ajax-with-promise.ts
Created January 15, 2017 11:33
HTTP Request with Promises in Typescript
getRequest(url: string): Promise<any> {
return new Promise<any>(
function (resolve, reject) {
const request = new XMLHttpRequest();
request.onload = function () {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error(this.statusText));
}
@dodikk
dodikk / about_swizzling.md
Last active October 22, 2017 20:36
Поговорки про swizzling
  • с утра посвизлил - весь день свободен
  • украл, посвиззлил - в тюрьму
  • волков бояться - в лесу не свиззлить
  • не все золото что свиззлит
  • свиззлинг - всему голова
  • и рыбку съесть, и посвиззлить
  • в большой семье свиззлом не щелкают
@tomconte
tomconte / web3-solc-contract-compile-deploy.js
Created December 13, 2016 09:32
Compiling and deploying an Ethereum Smart Contract, using solc and web3.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
// Connect to local Ethereum node
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// Compile the source code
const input = fs.readFileSync('Token.sol');
const output = solc.compile(input.toString(), 1);
@terhechte
terhechte / xcode-filler.sh
Created October 23, 2016 20:59
Fill Xcode Product with unused space so the app looks bigger than it is
# What crazy talk is this?
# See: https://twitter.com/myell0w/status/790245699694854145
#
# In a world where everything has to be bigger, faster, higher and more,
# users seem to have developed the expectation that the bigger the software
# package, the better the software. However, if you fill up your binary with
# useless data, the app store size might be too high and your app will
# require download over wifi.
#
# The following script can be added to your Xcode target as a shell script.
@steipete
steipete / SpinlockTestTests.swift
Last active August 29, 2023 08:47 — forked from RomanTruba/Synchronization_test_iOS_SDK10
Updated for Xcode 8, Swift 3; added os_unfair_lock
//
// SpinlockTestTests.swift
// SpinlockTestTests
//
// Created by Peter Steinberger on 04/10/2016.
// Copyright © 2016 PSPDFKit GmbH. All rights reserved.
//
import XCTest
@dooglus
dooglus / public.py
Created August 13, 2016 20:45
create Bitcoin public key from private key
#! /usr/bin/env python
class Point(object):
def __init__(self, _x, _y, _order = None): self.x, self.y, self.order = _x, _y, _order
def calc(self, top, bottom, other_x):
l = (top * inverse_mod(bottom)) % p
x3 = (l * l - self.x - other_x) % p
return Point(x3, (l * (self.x - x3) - self.y) % p)
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
@n00neimp0rtant
n00neimp0rtant / gist:27829d87118d984232a4
Last active May 24, 2019 15:10
UIVisualEffectView blur radius manipulation (new for iOS 9)
// iOS 9 allows you to animate between visual effects, which gives you the
// ability to manipulate the blur radius. this can be useful for animating
// a backdrop for a custom modal, and with a few tricks, can even be set
// indirectly, allowing you to "scrub" between them back and forth with
// a gesture, just like when you pull down Spotlight.
// these are the two effects you want to transition between
UIVisualEffect *startEffect = nil; // "nil" means no blur/tint/vibrancy (plain, fully-transparent view)
UIVisualEffect *endEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];