View gist:8e1d8c680a35a2d45b09
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
on escapeString(toEscape) | |
set res to replaceChars(toEscape, "\"", """) | |
set res to replaceChars(res, "'", "'") | |
set res to replaceChars(res, "&", "&") | |
set res to replaceChars(res, ">", ">") | |
set res to replaceChars(res, "<", "<") | |
return res | |
end escapeString | |
on replaceChars(this_text, search_string, replacement_string) |
View gist:2669f893f1bce329161a
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
on cmdTab() | |
tell application "System Events" | |
key down command | |
keystroke tab | |
key up command | |
end tell | |
end cmdTab |
View SimpleTwitter.sol
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
pragma solidity ^0.4.1; | |
import "strings.sol"; | |
contract SimpleTwitter { | |
using strings for *; | |
address public developer; | |
uint16 public maxTweetLength; | |
uint16 public maxNameLength; |
View handlers.cljs
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
(reg-event-fx | |
:blockchain/unlock-account | |
interceptors | |
(fn [{:keys [db]} [address password]] | |
{:web3-fx.blockchain/fns | |
{:web3 (:web3 db) | |
:fns [[web3-personal/unlock-account address password 999999 | |
:blockchain/account-unlocked | |
:log-error]]}})) |
View handlers.cljs
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
(reg-event-fx | |
:contract/fetch-compiled-code | |
interceptors | |
(fn [{:keys [db]} [on-success]] | |
{:http-xhrio {:method :get | |
:uri (gstring/format "/contracts/build/%s.json" | |
(get-in db [:contract :name])) | |
:timeout 6000 | |
:response-format (ajax/json-response-format {:keywords? true}) | |
:on-success on-success |
View handlers.cljs
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
(reg-event-fx | |
:initialize | |
(fn [_ _] | |
(merge | |
{:db db/default-db | |
:dispatch [:contract/fetch-compiled-code [:contract/compiled-code-loaded]]} | |
(when (:provides-web3? db/default-db) | |
{:web3-fx.blockchain/fns | |
{:web3 (:web3 db/default-db) | |
:fns [[web3-eth/accounts :blockchain/my-addresses-loaded :log-error]]}})))) |
View handlers.cljs
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
(reg-event-fx | |
:initialize | |
(fn [_ _] | |
(merge | |
{:db db/default-db | |
:dispatch [:contract/fetch-compiled-code [:contract/compiled-code-loaded]]} | |
(when (:provides-web3? db/default-db) | |
{:web3-fx.blockchain/fns | |
{:web3 (:web3 db/default-db) | |
:fns [[web3-eth/accounts :blockchain/my-addresses-loaded :log-error]]}})))) |
View handlers.cljs
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
(reg-event-fx | |
:contract/abi-loaded | |
interceptors | |
(fn [{:keys [db]} [abi]] | |
(let [web3 (:web3 db) | |
contract-instance (web3-eth/contract-at web3 abi (:address (:contract db)))] | |
{:db (assoc-in db [:contract :instance] contract-instance) | |
:web3-fx.contract/events |
View handlers.cljs
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
(reg-event-fx | |
:initialize | |
(fn [_ _] | |
(merge | |
{:db db/default-db | |
:http-xhrio {:method :get | |
:uri (gstring/format "/contracts/build/%s.abi" | |
(get-in db/default-db [:contract :name])) | |
:timeout 6000 | |
:response-format (ajax/json-response-format {:keywords? true}) |
View handlers.cljs
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
(reg-event-db | |
:contract/on-tweet-loaded | |
interceptors | |
(fn [db [tweet]] | |
(update db :tweets conj (merge (select-keys tweet [:author-address :text :name]) | |
{:date (u/big-number->date-time (:date tweet)) | |
:tweet-key (.toNumber (:tweet-key tweet))})))) |
OlderNewer