Skip to content

Instantly share code, notes, and snippets.

@kieranja
kieranja / gist:8957906
Last active November 21, 2023 16:23
Simple NodeJS client
function Client(ip, port, no_delay) {
this.ip = ip;
this.port = port;
this.no_delay = no_delay || true;
this.encoding = "utf8";
}
Client.prototype.init = function(new_payload_callback_fn) {
// Connect to main server.
@kieranja
kieranja / gist:10278326
Last active January 5, 2023 03:00
Laravel Batch Request
// Simple. This method allows you to make a request like http://myapi.com/api/batch?request=[{"url":"/api/profile/1", "type":"GET", "request_id":"1"}, {"url":"/api/profile/2", "type":"GET", "request_id":2}]
$requests = \Input::get('request');
$requests = json_decode($requests);
$output = array();
foreach ($requests as $request) {
$url = parse_url($request->url);
@kieranja
kieranja / gist:64cf8ef0b4e5c66be073
Last active August 29, 2015 14:02
Play Framework & Activator cheatsheet

Running on EC2 Microinstance

You'll need to lower the memory of the JVM:

echo 'export _JAVA_OPTIONS="-Xms128m -Xmx256m -XX:PermSize=64m"' >> ~/.bashrc

Then you'll need to add activator to the PATH variable

Delete files from Git forever: https://rtyley.github.io/bfg-repo-cleaner/
If Bamboo Agent takes a long time to start - make sure agent and master server are in SYNC TIME ZONE WISE (NTP)
@kieranja
kieranja / main.go
Created September 11, 2019 11:50
Export CSV statement from Monzo excluding Pot Transactions (total balance)
package main
import (
"encoding/csv"
"encoding/json"
"fmt"
"github.com/davecgh/go-spew/spew"
"github.com/manifoldco/promptui"
"io"
"log"
@kieranja
kieranja / fileMapper.js
Created November 15, 2019 00:07
i hate git conflicts
--- old.js 2019-11-15 00:02:06.000000000 +0000
+++ new.js 2019-11-15 00:05:49.000000000 +0000
@@ -225,6 +225,43 @@
}
/**
+ * It's likely ids should be kept in this scenario,
+ * as they're used further down
+ * @param obj
+ */
{%- macro classNames(classes) -%}
{%- set final = [] %}
{%- for class, isActive in classes.items() -%}
{% if isActive %}{% do final.append(class) %}{% endif %}
{%- endfor -%}
{%- if final|count -%}
{{ { "class": final | join(" ") }|xmlattr }}
{%- endif -%}
{%- endmacro -%}
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "na1",
portalId: "6569536",
formId: "877b7f5b-ef95-4479-940e-af14e8da7bd3"
});
</script>