Instantly share code, notes, and snippets.

View gist:6e4b5fdc141025d609756f8aa5a20d63
{
"nonce": "0x0000000000000042",
"difficulty": "0x40000",
"alloc": {
"YOUR_COINBASE_ADDRESS": {
"balance": "10015200000000000000000"
}
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
View FixVideoLinksToHttps.js
var videoTags = document.getElementsByTagName('video');
var result = [];
result.push('====\n')
for (var i = 0; i < videoTags.length; i++)
{
// result.push("====singleVideoTag \n");
var singleVideoTag = videoTags[i];
View shared.rs
use std::rc::Rc;
use std::cell::{RefCell,Ref, RefMut};
use std::ops::Deref;
use std::fmt;
#[derive(Clone)]
struct Shared<T> {
v: Rc<RefCell<T>>
}
View EmailValidationRegex.swift
private static func validateEmailByBootstrapRegex(_ userInput: String) -> Bool
{
var emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegex)
return emailTest.evaluate(with: userInput)
}
// TODO: is NSPredicate any better
View debounce-throttle.swift
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {
View NSObject+Debounce.h
@interface NSObject (Debounce)
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay;
@end
View estimating_joke_ru.md

— Слушай, ты разработчик. Ответь, почему разработчики всегда неправильно оценивают время на создание программ?

— Представь что тебе надо разгрузить машину, сколько времени это займет?
— Пару часов
— Это камаз
— 8 часов
View ChatDetailsRepoRealm.swift
public func storeChatDetailsAsync(
_ item: ChatDetailsInfoType,
callback: @escaping GroupChatDetailsFetchCompletion)
{
self._queue.async
{
[weak weakSelf = self] in
guard let strongSelf = weakSelf
else
View PromiseAndResult.swift
import FutureKit
extension Promise {
func getCallbackForService() -> ( (Result<T>) -> Swift.Void )
{
return self.completeWithResult
}
func completeWithResult(result: Result<T>) {
View NumbersPadKeyValuePairView.xaml
<?xml version="1.0" encoding="UTF-8"?>
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SampleFormsProject.Views.NumbersPadKeyValuePairView"
xmlns:ns_sample_control="clr-namespace:SampleFormsProject.Views;assembly=SampleFormsProject"
>
<ContentView.Content>