Skip to content

Instantly share code, notes, and snippets.

View eleventigers's full-sized avatar

Jokubas Dargis eleventigers

View GitHub Profile
@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

/***
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 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'
}
(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

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: