Skip to content

Instantly share code, notes, and snippets.

View nickborysov's full-sized avatar
🚀

Mykola Borysov nickborysov

🚀
View GitHub Profile
JSON tag from BSON
find: (bson:("[^\"]{1,}"))
replace: json:$2 bson:$2
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
package trello
import "encoding/json"
type Cards []Card
func UnmarshalCards(data []byte) (Cards, error) {
var r Cards
err := json.Unmarshal(data, &r)
return r, err
/*
Javascript code fore make injection of web3. The code was based on https://github.com/TrustWallet/trust-wallet-ios
*/
configureWallet()
configureWeb3()
function configureWallet() {
wallet.callbacks = {};
fun loadAccounts(onSuccess: ((accounts: Accounts?) -> (Unit)),
onError: ((exception: Throwable?) -> (Unit))) {
call( { ethereumManager.getAccounts() },
onSuccess,
onError)
//
// Observable.just(callToSingle { ethereumManager.getAccounts() })
// .subscribe(
// { accounts -> onSuccess(accounts.blockingGet()) },
{"retailers":[{"retailer":"Macy's","shipping_cost":0.0,"free_shipping_order_amount":0.0,"standard_shipping_time":null,"products":[{"cart_product_id":1045,"product_id":48645,"name":"Betsy \u0026 Adam Bell-Sleeve Sheath Dress","web_url":"https://img.shopstyle-cdn.com/pim/06/d8/06d8541d320def8c3721e3c604337887_best.jpg","swatch_url":"https://lilyapp-assets.s3-us-west-2.amazonaws.com/swatch_images/06d8541d320def8c3721e3c604337887_Dusty%20Blue.jpg","standard_shipping_time":null,"price":"149.99","in_stock":true,"size":"10","color":"Dusty Blue"},{"cart_product_id":1044,"product_id":48645,"name":"Betsy \u0026 Adam Bell-Sleeve Sheath Dress","web_url":"https://img.shopstyle-cdn.com/pim/06/d8/06d8541d320def8c3721e3c604337887_best.jpg","swatch_url":"https://lilyapp-assets.s3-us-west-2.amazonaws.com/swatch_images/06d8541d320def8c3721e3c604337887_Dusty%20Blue.jpg","standard_shipping_time":null,"price":"149.99","in_stock":true,"size":"10","color":"Dusty Blue"}]},{"retailer":"Nordstrom","shipping_cost":0.0,"free_shipping_ord
@nickborysov
nickborysov / OverpassDataSource
Last active September 8, 2017 11:03
DataSource loads data with roads and speeds from Overpass API (OpenStreetMap) and looks nearest road with speed limit.
import android.support.annotation.Nullable;
import android.util.Log;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.app.App;
import com.app.utils.LatLngHelper;
import static com.app.NODE_MAX_DISTANCE;
import java.util.AbstractMap;
@nickborysov
nickborysov / ProfileFragment
Last active September 8, 2017 11:04
ProfileFragment implements UI for profile screen. It uses pattern View Holder for source code composition and implementing interface AppMode.ModeConfigurable.
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
/**
* Class {@link Factorial}
* Counts factorial and sum of the digits
*/
public class Factorial {
private int[] factorial;
private int number;
private int digitsNumber;