Skip to content

Instantly share code, notes, and snippets.

View eleventigers's full-sized avatar

Jokubas Dargis eleventigers

View GitHub Profile
(function() {
var SECTION = "date";
var NOW = "now";
Playtomic.Date = {
now: function(callback) {
sendAPIRequest(SECTION, NOW, dateComplete, callback);
}
};
@eleventigers
eleventigers / gist:8428111
Last active January 3, 2016 07:18
Found on HN

Note to a PSD web designer

First, PSD's that assume text length. For example, if you have three call-out boxes with a title and some text to follow, don't assume that the title will always be one line and the text will always be the same length. Instead, figure out what this will all look like when you do have very uneven amounts of text. Do we center it vertically? Do we abbreviate it?

Second, PSD's that don't assume a responsive design. Sure, working directly in the medium (HTML/CSS) would solve this, but you can still provide some direction here. Tell me how the columns should be laid out. Which parts of the site should expand/collapse with size, which parts can be hidden, etc.

Third, and this goes without saying, but clean up the PSD layer names and groupings. Layer 1, Layer 2, etc. is not a great convention for this.

Fourth, show me the unusual cases. I know the clients always want to focus on the prominent pages, like the home page, the product listing, etc. Those are impo

@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

@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;
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)
}
/***
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.
#!/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
@eleventigers
eleventigers / build.gradle
Created October 24, 2015 13:44
Gradle: suppress SNAPSHOT dependencies caching
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}