Skip to content

Instantly share code, notes, and snippets.

View ivanstojic's full-sized avatar
🚣‍♂️

Ivan Stojic ivanstojic

🚣‍♂️
View GitHub Profile
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>
using namespace rapidjson;
int main() {
const char* json = "{\"thing\":-1.1030161663305387}";
Document d;
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>
using namespace rapidjson;
int main() {
const char* json = "{\"shit\":-1.1030161663305387}";
Document d;
@ivanstojic
ivanstojic / cpanm-vulcan.sh
Created September 11, 2012 23:31
Script for setting up CPANM and W3C validator dependencies on Heroku using Vulcan
# CPANM
curl -L http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/perl5/environment
# Install Perl bundle of W3C dependencies
cpanm Bundle::W3C::Validator
@ivanstojic
ivanstojic / heroku.patch
Created September 7, 2012 06:06
Patch to get Validator.nu running on Heroku
diff -rupN validator/src/nu/validator/servlet/Main.java validator/src/nu/validator/servlet/Main.java
--- validator/src/nu/validator/servlet/Main.java 2012-09-07 00:34:08.000000000 +0200
+++ validator/src/nu/validator/servlet/Main.java 2012-09-07 00:39:46.000000000 +0200
@@ -117,8 +117,10 @@ public class Main {
serverSocket.close();
} else {
server.start();
- System.in.read();
- server.stop();
+
// Hide the trigger DIV
this.controller.get("myTriggerDiv").hide();
// Show the widget
this.controller.get("myTextEditor").show();
this.controller.get("myTextEditor").mojo.focus();
// Top event propagation or else...
event.stopPropagation();
// Setup the TextField so we can show it later
this.controller.setupWidget("myTextEditor",
this.widgetAttributes,
this.widgetModel);
// Then hide it until we need it...
this.controller.get("myTextEditor").hide();
// Listen for the tap event on the DIV...
Mojo.Event.listen(this.controller.get("myTriggerDiv"),
String.prototype.toCamelCase = function(major) {
var str = this.toString().replace(/[\-_\s](.)/g, function(m, l) {
return l.toUpperCase();
});
if (major) {
str = str.substr(0, 1).toUpperCase() + str.substr(1);
}
return str;