Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy Roman jeremyroman

View GitHub Profile
@jeremyroman
jeremyroman / README.txt
Created May 4, 2021
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.1+commit.df193b15.js&optimize=false&runs=200&gist=
View README.txt
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@jeremyroman
jeremyroman / bikeshedproxy.js
Last active Jan 21, 2021
server to proxy requests to CSSWG bikeshed
View bikeshedproxy.js
#!/usr/bin/env node
const crypto = require('crypto');
const http = require('http');
const https = require('https');
const fs = require('fs');
http.createServer((req, res) => {
if (req.url !== '/') {
res.writeHead(404);
res.end();
View any.cc
class AssociatedFrobnicator : public base::SupportsUserData::Data {
public:
Frobnicator* frobnicator() const { return frobnicator_; }
void set_frobnicator(Frobnicator* frobnicator) const { frobnicator_ = frobnicator; }
private:
Frobnicator* frobnicator_;
};
base::SupportsUserData::Data* data;
static_cast<AssociatedFrobnicator*>(data)->set_frobnicator(new_frobnicator);
View 1918187-fix.patch
diff --git a/third_party/blink/renderer/modules/modules_initializer.cc b/third_party/blink/renderer/modules/modules_initializer.cc
index 4eaa4575ca63..50e56db64b5b 100644
--- a/third_party/blink/renderer/modules/modules_initializer.cc
+++ b/third_party/blink/renderer/modules/modules_initializer.cc
@@ -170,6 +170,8 @@ void ModulesInitializer::InitLocalFrame(LocalFrame& frame) const {
&AppBannerController::BindMojoRequest, WrapWeakPersistent(&frame)));
frame.GetInterfaceRegistry()->AddInterface(WTF::BindRepeating(
&TextSuggestionBackendImpl::Create, WrapWeakPersistent(&frame)));
+ frame.GetInterfaceRegistry()->AddInterface(WTF::BindRepeating(
+ &RemoteObjectGatewayImpl::BindMojoReceiver, WrapWeakPersistent(&frame)));
View gist:5fdd586eee87cd2b8309689394a95c6b
#0 0x00007ffff79f2e10 in IPC::(anonymous namespace)::ChannelAssociatedGroupController::DetachEndpointClient(mojo::ScopedInterfaceEndpointHandle const&) (this=0x3c9213fe3aa0, handle=...) at ../../ipc/ipc_mojo_bootstrap.cc:362
#1 0x00007ffff791adf7 in mojo::InterfaceEndpointClient::~InterfaceEndpointClient() (this=0x3c921528b2e0) at ../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:178
#2 0x00007ffff791afac in mojo::InterfaceEndpointClient::~InterfaceEndpointClient() (this=0x3c921528b2e0) at ../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:175
#3 0x00007ffff78f949f in std::__Cr::default_delete<mojo::InterfaceEndpointClient>::operator()(mojo::InterfaceEndpointClient*) const (this=0x3c92146c28c0, __ptr=0x3c921528b2e0) at ../../buildtools/third_party/libc++/trunk/include/memory:2338
#4 0x00007ffff78f8b9d in std::__Cr::unique_ptr<mojo::InterfaceEndpointClient, std::__Cr::default_delete<mojo::InterfaceEndpointClient> >::reset(mojo::InterfaceEndpointClient*) (this=0x3c92146c28c0, __p
View foo.cc
PlatformPaintWorkletInput(
Vector<std::pair<CSSPropertyID, String>> native_values)
: native_values_(std::move(native_values)) {
for (auto& pair : native_values_) {
String& s = pair.second;
if (!s.IsSafeToSendToAnotherThread())
s = s.IsolatedCopy();
}
}
View mojo-iothread.diff
diff --git a/content/browser/web_package/web_package_context_impl.cc b/content/browser/web_package/web_package_context_impl.cc
index ea3956d77739..86367c49ad54 100644
--- a/content/browser/web_package/web_package_context_impl.cc
+++ b/content/browser/web_package/web_package_context_impl.cc
@@ -4,40 +4,19 @@
#include "content/browser/web_package/web_package_context_impl.h"
-#include "base/bind.h"
-#include "base/single_thread_task_runner.h"
@jeremyroman
jeremyroman / api.cc
Created May 2, 2017
public/private API class trick
View api.cc
namespace blink {
class RealClass : public RealBase {
public:
static RealClass* Create();
void DoSomething();
private:
// members here
};
@jeremyroman
jeremyroman / idl_union.cc
Last active Apr 25, 2017
union template sketch
View idl_union.cc
// template definition
template <int index, typename... UnionMemberTraits>
class IDLUnionImpl {
public:
bool IsNull() const { return type_ == 0; }
protected:
int type_ = 0;
};
template <int index, typename UnionMemberTraits, typename... Rest>
View wasm.cpp
class ValueSerializer {
class Delegate {
/*
* Delegate serializes the module content and returns an ID representing it.
* Using v8::WasmCompiledModule::GetTransferrableModule is recommended for efficiency,
* but a V8 client could do something else (like store the wire bytes, or store
* a URL to remote server that hosts wasm modules, or something else).
*/
virtual Maybe<uint32_t> GetWasmCompiledModuleId(
Isolate* isolate, Local<WasmCompiledModule> wasm_module);