This file contains hidden or 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.8.13; | |
import "forge-std/Test.sol"; | |
import "forge-std/console2.sol"; | |
contract AmplGonBalanceChangeTest is Test { | |
// The proxy address of the UFragments (AMPL) contract. | |
// Replace with the correct **proxy** address in your environment. | |
address internal constant AMPL_PROXY = 0xD46bA6D942050d489DBd938a2C909A5d5039A161; |
This file contains hidden or 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
function $waitForOneBlock(){ | |
const id = Date.now(); | |
return new Promise((resolve, reject) => { | |
web3Instance.currentProvider.send({ | |
jsonrpc: "2.0", | |
method: "evm_mine", | |
params: [], "id": id, | |
}, function(e,r){ | |
if(e) reject(e); |
This file contains hidden or 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
from multiprocessing import Pool | |
from os import listdir, stat, rename, mkdir, rmdir | |
from os.path import join, isdir, getsize | |
import sys | |
def listFolders(path): | |
return filter(lambda f: isdir(join(path, f)), listdir(path)) | |
PATH = sys.argv[1] |
This file contains hidden or 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
"/api/v1/resources/:resource_id" | |
"/api/v1/master/:master_id/resources/:id" | |
{ | |
master_id: "master_id", | |
resource_id: "resource_id", | |
} | |
var Resource = function(url, map){ |
This file contains hidden or 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
class ArrayInquirer < Array | |
private | |
def method_missing method, *args | |
begin | |
any? { |elem| elem.to_s == method[0..-2] } | |
rescue NoMethodError | |
super method, *args | |
end | |
end | |
end |
This file contains hidden or 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
class OrdersQuery | |
def initialize(relation = Order.all) | |
@relation = relation.extending(Scopes) | |
end | |
def find | |
@relation.includes(:order_state, | |
:region, | |
:merchant_payment_method_currency => [ | |
:merchant, :payment_method_currency => [ :payment_method_branch ] |
This file contains hidden or 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
class With | |
attr_accessor :object, :result | |
def initialize(object) | |
@object = object | |
@result = nil | |
end | |
def method_missing(method, *args, &block) |
This file contains hidden or 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
module Util | |
class MessageHandler | |
@@data = {} | |
class << self | |
def data_in(language) | |
load! if !@@data[language] or (files_changed? and Rails.env.development?) | |
@@data[language][language.to_s] |
This file contains hidden or 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
def render(view_name) | |
filename = File.join "app", "views", "#{view_name}.html.erb" | |
template = File.read filename | |
eruby = Erubis::Eruby.new(template) | |
eruby.result | |
end |
This file contains hidden or 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
var Promise = function(){ | |
this.pending = []; | |
} | |
Promise.prototype = { | |
then: function(onResolve, onReject){ | |
this.pending.push({ | |
resolve: onResolve, | |
reject: onReject |
NewerOlder