Skip to content

Instantly share code, notes, and snippets.

View GregoryHlavac's full-sized avatar

Gregory Hlavac GregoryHlavac

  • Freelance
  • United States
View GitHub Profile
template <typename ReturnType, typename... ArgumentTypes>
struct FunctionGear
{
typedef std::function<ReturnType(ArgumentTypes...)> NativeFunction;
FunctionGear(NativeFunction nf) : mNativeFunction(nf){}
void Invoke(const v8::FunctionCallbackInfo<v8::Value> args)
{
size_t currentArgumentIndex = args.Length() - 1;
app.post('/submit', function(req, res) {
var cdOpts = {
maxFilesSize: app.nconf.get("submit_file_byte_limit"), // This is 2 MB
autoFields: true,
autoFiles: true,
uploadDir: "./minidumps"
};
var form = new multiparty.Form(cdOpts);
app.use('/api', sleep.createEndpoint(
[
{
model: db.Project,
options: {
walk_depth: 3
},
routes: {
get: [
Sleep.Scaffolding.Pagination
@GregoryHlavac
GregoryHlavac / WebSocketExample.java
Created April 11, 2015 22:15
Enabling websockets in spark with @davidvollmar 's socket and servlet adapters combined with an altered way to mount the rest of the handlers.
package spark;
import org.eclipse.jetty.servlet.ServletContextHandler;
public class WebSocketExample
{
public static void main(String[] args)
{
setupSpark();
Spark.get("/", (request, response) -> "Hello");
using PID;
using ns0;
namespace ns2
{
/// <summary>
/// Class10
/// </summary>
internal class EncryptionTogglePatcher : IFindAndReplaceSignature
{
this.arguments.addListener(new COMStringSetter(link::SetArguments));
this.path.addListener(new COMStringSetter(link::SetPath));
this.title.addListener(new COMPropertySetter<>(PKEY.Title, propertyStore::setString));
this.toolTip.addListener(new COMStringSetter(link::SetDescription));
this.workingDirectory.addListener(new COMStringSetter(link::SetWorkingDirectory));
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.Reflection;
using System.IO;
using DOL.GS;
SELECT TargetTable.*
FROM FT_SEARCH_DATA('called', 0, 0) SearchData, TEST TargetTable
WHERE TargetTable.ID=SearchData.KEYS[0]
AND SearchData.TABLE='TEST'
// This #include statement was automatically added by the Particle IDE.
#include <MCP9808.h>
int MAX_DISTANCE = 200;
int PING = D6;
int RED = A2;
int GREEN = A3;
MCP9808 mcp = MCP9808();
#include <iostream>
using namespace std;
int length, width, area;
void welcomeMessage()
{
cout << "This program was designed to calculate the area of a triangle.\n" << endl;
}