This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Rope = Empty | Concat Int Rope Rope | Leaf String deriving (Show, Eq) | |
rope :: String -> Rope | |
rope "" = Empty | |
rope s = Leaf s | |
len :: Rope -> Int | |
len Empty = 0 | |
len (Leaf s) = length s | |
len (Concat length _ _) = length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright © 2009, Componentix. All rights reserved. | |
*/ | |
package com.componentix.hibernate.dialect; | |
import java.sql.Types; | |
/** | |
* A proper dialect for Microsoft SQL Server 2000 and 2005. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSObject+KVOWeakPropertyDebug.h | |
// KVOWeakPropertyDebug | |
// | |
// Created by Vladimir Grichina on 12.01.13. | |
// Copyright (c) 2013 Vladimir Grichina. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
book_train_and_hotel() : void { // Needs 6 MANA. | |
// 3 for train and callback and 3 for hotel and callback. | |
// E.g. book_train and book_hotel doesn't need additional mana, so only 1 MANA for a call. | |
// Callback may need 1 additional to cancel train or hotel booking if one of them failed. | |
assert_has_mana(6); | |
let hotelBooking = bookHotel.withMana(3).withCoins(1000).book(sender()); | |
let trainBooking = bookTrain.withMana(3).withCoins(1000).book(sender()); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CellBackgroundView.h | |
// | |
// | |
#import <UIKit/UIKit.h> | |
typedef enum { | |
CellPositionTop, | |
CellPositionMiddle, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const url = require('url'); | |
const hostname = '127.0.0.1'; | |
const port = 3000; | |
const server = http.createServer((req, res) => { | |
res.statusCode = 200; | |
res.setHeader('Content-Type', 'text/html'); | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nearlib = require('nearlib'); | |
const { signTransaction, transfer } = nearlib.transactions; | |
const { base_decode } = nearlib.utils.serialize; | |
const sleep = (ms) => new Promise((resolved) => setTimeout(resolved, ms)); | |
(async () => { | |
const [,, accountId, txCount] = process.argv; | |
const near = await nearlib.connect({...require('near-shell/get-config')(), deps: { keyStore: new nearlib.keyStores.UnencryptedFileSystemKeyStore('./neardev') } }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// array.h - CKit | |
// | |
// (c) 2009 TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed) | |
// | |
#ifndef __CKIT_ARRAY__ | |
#define __CKIT_ARRAY__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[I] ➜ yarn start | |
yarn run v1.21.1 | |
warning package.json: No license field | |
$ npm run build && near deploy --wasmFile ./contract/res/status_message.wasm | |
npm WARN lifecycle The node binary used for scripts is /var/folders/3c/zjk2krns25s75x_z2_wdvgg80000gn/T/yarn--1580160108615-0.8711654915114355/node but npm is using /Users/vg/n/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. | |
> blank-rust-proj-vg@0.0.1 build /Users/vg/Documents/create-near-app/blank-rust-proj-vg | |
> cd contract && ./build.sh | |
Updating crates.io index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function deploy(options) { | |
const configPath = process.cwd() + '/src/config'; | |
const config = require(configPath)(process.env.NODE_ENV || 'development'); | |
const near = await nearlib.connect({...config, deps: { keyStore: new UnencryptedFileSystemKeyStore('./neardev') } }); | |
const contractData = [...fs.readFileSync(options.wasmFile)]; | |
const account = await near.account(options.accountId); | |
await account.signAndSendTransaction(options.accountId, [ | |
deployContract(contractData), | |
// TODO: Use whatever actual params need to be for functionCall or include any other actions as well |