Skip to content

Instantly share code, notes, and snippets.

View eleventigers's full-sized avatar

Jokubas Dargis eleventigers

View GitHub Profile

Keybase proof

I hereby claim:

  • I am eleventigers on github.
  • I am eleventigers (https://keybase.io/eleventigers) on keybase.
  • I have a public key whose fingerprint is FFE9 5F15 CED4 443E C163 B08D 4D52 DD4A E48A 728E

To claim this, I am signing this object:

@eleventigers
eleventigers / build.gradle
Created December 16, 2015 10:30
Configures all JUnit (or TestNG) test tasks to write message to console whenever "test failed" / "test passed" / "test skipped" events occur.
tasks.matching {it instanceof Test}.all {
testLogging.events = ["failed", "passed", "skipped"]
}
@eleventigers
eleventigers / build.gradle
Created October 24, 2015 13:44
Gradle: suppress SNAPSHOT dependencies caching
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
#!/bin/sh
# Convert ANSI (terminal) colours and attributes to HTML
# Licence: LGPLv2
# Author:
# http://www.pixelbeat.org/docs/terminal_colours/
# Examples:
# ls -l --color=always | ansi2html.sh > ls.html
# git show --color | ansi2html.sh > last_change.html
/***
Copyright (c) 2014 CommonsWare, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.
import org.apache.tools.ant.taskdefs.condition.Os
def getPlatformNdkBuildCommand() {
def rootDir = project.rootDir
def localProperties = new File(rootDir, "local.properties")
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream {
instr -> properties.load(instr)
}
@eleventigers
eleventigers / GLTextureView.java
Created March 14, 2014 10:34
GLTextureView from GLSurfaceView
import java.io.Writer;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGL11;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL;
@eleventigers
eleventigers / cookies.md
Last active August 29, 2015 13:56
Redis and Rendr

To load sessions into the Rendr app I used connect-redis from visionmedia. Whatever I set on req.session will be stored in a Redis store.

In a custom data-adapter that communicates with our API, I send relevant cookies through the request method. So for example when my data-adapter tries to authenticate with the API on success it should receive a response with sessions cookies set by Deployed. What I do is I save those cookies into req.session and the next time data-adapter does a request I take them out of the cookie jar and put them on top of the request - Deployed links this request with a session on Rendr in this way. Remember that a custom data-adapter can be augmented by any express middleware that comes before it, whether it sets stuff on req.session or else.

This is what I wrote when I needed to pass cookies around, it probably sucks but hey it worked at that time:

if(req.session){
   jar = request.jar();

if(req.session[sessCookiePat