Skip to content

Instantly share code, notes, and snippets.

View jeremyroman's full-sized avatar

Jeremy Roman jeremyroman

View GitHub Profile
@jeremyroman
jeremyroman / setuid.c
Last active August 29, 2015 13:56
setuid by id
#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;
}
@jeremyroman
jeremyroman / index.html
Created July 8, 2014 21:26
DAOListView + Array = wtf?
<!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 / README.md
Created July 10, 2014 19:11
DAOListView + DAOListView = ???

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)

<!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 / textblob-counter.diff
Created September 24, 2014 21:14
text blob counting patch
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;
+
@jeremyroman
jeremyroman / gist:255e8b820c7d64479af1
Created July 8, 2015 14:37
SimpleShaperTest excerpt
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 / gist:815849
Created February 8, 2011 04:24
One possible way of describing languages
languages = {
"C": {
'main_file': "{bot}.c",
'nuke_globs': ["*.o", "{bot}"],
'compile': [
System("gcc -O3 -c {file}", glob="*.c"),
System("gcc -O2 -lm -o {bot}", glob="*.o"),
],
'run': "./{bot}",
},
var f = function() {};
f.prototype.food = { apples: 0, bananas: 0 };
var f1 = new f();
f1.food.apples++;
var f2 = new f();
console.log(f2.food.apples); // 1
This is because the food object is modified in-place, and both instances refer to the same object.
// a.js
exports.message = 'hello world!';
exports.b = require('./b');
// b.js
var a = require('./a');
module.exports = function() { return a.message; }
var http = require('http'),
qs = require('querystring');
var body = qs.stringify({ method: 'system.connect' });
var options = {
host: 'www.goworkit.com',
port: 80,
path: '/services/json/',
method: 'POST',
headers: {