Skip to content

Instantly share code, notes, and snippets.

View frelar's full-sized avatar

Fredrik Larsson frelar

  • Stockholm, Sweden
View GitHub Profile
@frelar
frelar / pdf-soap.js
Last active October 31, 2017 22:39
Small boilerplate for the next project using async.waterfall
var async = require('async'),
open = require('open');
async.waterfall([
async.constant({
output: './pba.pdf'
}),
loadRequest,
loadResponse,
extractPdf,
#!/usr/bin/env ruby
# SweDB XMLTV Grabber for EyeTV
# by Henrik Nyh <http://henrik.nyh.se> under the MIT License.
# Configure the list of channels below and run this script as a cron job, e.g.
# 0 */12 * * * ruby /path/to/this/script.rb
# to run it every 12 hours (suggested since cron jobs don't run if the computer is off).
# For more detailed instructions (in Swedish), see
# http://forums.elgato.com/viewtopic.php?f=86&t=1627&p=16279#p16420.
@frelar
frelar / gist:2898243
Created June 8, 2012 21:43
Web.xml fragment for WRO4J
<!-- Creates a filter for optimizing css,less,javascript and other web resources -->
<filter>
<filter-name>WebResourceOptimizer</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>wroFilter</param-value>
</init-param>
<!-- Stupid override to make sure that the servlet filter configuration is read from the -->
<!-- spring-mvc-context.xml config instead of spring-business-context.xml -->
@frelar
frelar / gist:1725594
Created February 2, 2012 20:32
Sas avatar
<a href="javascript:window.open('http://eva.csoica.artificial-solutions.com/cgi-bin/sas.cgi?WT.ac=eva',
'eva','width=250,height=595,scrollbars=no,location=no,
left=740,top=200,menubar=no,alwaysRaised=yes,resizable=no,
toolbar=no').focus();">
<img src="/upload/Global/NewRedHeader/EVA_HEADER.png" alt="Eva">
</a>
@frelar
frelar / gist:1391458
Created November 24, 2011 14:23
First BOM example
{
"typeOfObject" : "branch",
"profitCentre" : "2050001127",
"searchTerm" : "Östra Hamngatan 2,Göteborg",
"places" : [{
"profitCentre" : "2050001127",
"street_address" : "Östra Hamngatan 16,Göteborg",
"postal_code" : "405 09",
"region" : "Göteborg",
"country" : "Sverige",
@frelar
frelar / gist:1364203
Created November 14, 2011 15:41
Array concat?
var m = function () {
emit(
{ lat : this.geo.loc.lat, long : this.geo.loc.lon },
{ count : 1, extIds : [this._id] }
);
}
var r = function (key, values) {
var row = { count : 0, extIds : [] };
for (var i in values) {
row.count += values[i].count;
@frelar
frelar / gist:1364051
Created November 14, 2011 14:27
Search is different between branch and atm
// Kolla in search
// 1) postnr på branch är det 432 19, Varberg men på atm bara 43241.
// 2) Sverige? på atm...helt onödigt.
// 3) gata...saknar ,Varberg på slutet.
// detta måste vara samma annars blir autocomplete fel.
// db.placessv_SE.find( { "geo.loc.lat" : 57.105324, "geo.loc.lon" : 12.251469 }, { search : 1 } );
[{
"_id" : "sv_SE:branch:3332",
"search" : [
"Varberg",