Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy Roman jeremyroman

View GitHub Profile
@jeremyroman
jeremyroman / api-dictionary.cc
Created Mar 14, 2017
v8::DictionarySchema to make reading dictionaries fast
View api-dictionary.cc
Local<DictionarySchema> DictionarySchema::New(Isolate* v8_isolate,
Local<Value> keys[],
int keyCount) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
i::Handle<i::DictionarySchema> schema = i::DictionarySchema::New(isolate, keyCount);
for (int i = 0; i < keyCount; i++) {
Handle<Object> key = Utils::OpenHandle(keys[i]);
uint32_t array_index;
Utils::ApiCheck(key->IsName() || key->ToArrayIndex(&array_index),
@jeremyroman
jeremyroman / api_signature.cc
Created Dec 22, 2016
WDYT of templating APISignature::ParseArgumentsImpl
View api_signature.cc
namespace {
class V8ParsingBuffer {
public:
V8ParsingBuffer(std::vector<v8::Local<v8::Value>> values, v8::Isolate* isolate)
: values_(values), isolate_(isolate) {}
void AddNull() { values_.push_back(v8::Null(isolate)); }
std::nullptr_t GetParsedArgumentBuffer() { return nullptr; }
void AddParsedArgument(v8::Local<v8::Value> value) { values_->push_back(value); }
private:
View pre-commit
#!/bin/sh
if [[ "$(git symbolic-ref HEAD)" = "refs/heads/master" ]]; then
echo "Refusing to commit on master." >&2
exit 1
fi
View gist:255e8b820c7d64479af1
class TestFontSelector : public FontSelector {
public:
static PassRefPtr<TestFontSelector> create(const String& path)
{
WebUnitTestSupport* unitTestSupport = Platform::current()->unitTestSupport();
String filePath = unitTestSupport->webKitRootDir() + path;
RefPtr<SharedBuffer> fontBuffer = static_cast<PassRefPtr<SharedBuffer>>(unitTestSupport->readFromFile(filePath));
return adoptRef(new TestFontSelector(FontCustomPlatformData::create(fontBuffer.get())));
}
@jeremyroman
jeremyroman / textblob-counter.diff
Created Sep 24, 2014
text blob counting patch
View textblob-counter.diff
diff --git a/Source/core/rendering/TextPainter.cpp b/Source/core/rendering/TextPainter.cpp
index 3901813..4133ea0 100644
--- a/Source/core/rendering/TextPainter.cpp
+++ b/Source/core/rendering/TextPainter.cpp
@@ -178,6 +178,8 @@ static bool graphicsContextAllowsTextBlobs(GraphicsContext* context)
return !context->strokeGradient() && !context->strokePattern() && !context->fillGradient() && !context->fillPattern();
}
+static unsigned long g_totalBlobsPainted = 0;
+
View index.html
<!DOCTYPE html>
<script src="foam/core/bootFOAM.js"></script>
<link rel="stylesheet" href="foam/core/foam.css">
<script>
MODEL({
name: 'Gadget',
properties: ['id', 'inventor'],
});
@jeremyroman
jeremyroman / README.md
Created Jul 10, 2014
DAOListView + DAOListView = ???
View README.md

Expected: can see three lists of detail views. Actual: can only see the first one; inspecting the DOM reveals that all three of the nested list views have the same ID (in my case, view3)

@jeremyroman
jeremyroman / index.html
Created Jul 8, 2014
DAOListView + Array = wtf?
View index.html
<!DOCTYPE html>
<script src="foam/core/bootFOAM.js"></script>
<link rel="stylesheet" href="foam/core/foam.css">
<script>
MODEL({
name: 'Widget',
properties: ['gizmo'],
});
@jeremyroman
jeremyroman / setuid.c
Last active Aug 29, 2015
setuid by id
View setuid.c
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
uid_t uid = (uid_t) atoi(argv[1]);
setuid(uid);
execl("/bin/sh", "sh", (char*) 0);
return 1;
}
View gist:8681576
Thank you for sending me CSC's information for this term.
In case you are not already aware, due to your late submission, your budget will not be considered at the budget meeting on Wednesday. The reason for this is because of MathSoc's Policy 6.3.1, which reads:
"If a club fails to submit its complete budget package on time, its package shall not be considered at the budget meeting, even if submitted before the meeting, and the club's funding shall be withheld until its budget is approved by Council."
If you have any questions or concerns regarding the above, please let me know.
Thank you,