Skip to content

Instantly share code, notes, and snippets.

View erikfried's full-sized avatar

Erik Fried erikfried

View GitHub Profile
@erikfried
erikfried / pulse2_section_page_0.2.json
Last active August 29, 2015 14:23
Example of pulse2 tagging of section page
[
{
"@context": [
"http://www.w3.org/ns/activitystreams",
{
"spt": "http://schibsted.com",
"spt:sdkType": "JS",
"spt:sdkVersion": "0.3.0"
}
],
@erikfried
erikfried / pulse2_premium_page_tracking.json
Last active August 29, 2015 14:23
Example of pulse2 tracking for a plus article page
[
{
"@context": [
"http://www.w3.org/ns/activitystreams",
{
"spt": "http://schibsted.com",
"spt:sdkType": "JS",
"spt:sdkVersion": "0.3.0"
}
],
@erikfried
erikfried / BoomerangVelvetMetrics.html
Created March 2, 2011 13:38
A very simple test, using velvetmetrics as reporting backend to boomerang
<!DOCTYPE html>
<html>
<head>
<title>Velvet test with BOOMR</title>
</head>
<body>
<h1>Testing roundtrip time</h1>
<p>Using <a href="http://developer.yahoo.com/blogs/ydn/posts/2010/06/performance_testing_with_boomerang/">Boomerang</a> and <a href="http://www.velvetmetrics.com/">velvetmetrics</a></p>
<p id="results"></p>
<img src="http://www.velvetmetrics.com/chart?&path=random.path.3yb8s&groupBy=10min&f=avg&datapoints=true&title=true&axes=true&legends=true&customtitle=Avg%20roundtrip%20time%20/10%20mins&w=600&h=250&output=image&rand=2612" alt="loadtime history"/>
@erikfried
erikfried / MyModule.js
Created July 1, 2011 09:51
Testing YUI3 modules with Jasmine
YUI.add("my-module", function (Y) {
Y.namespace("mynamespace");
Y.mynamespace.MyModule = function () {
return {hello : "hello"};
};
}, '0.0.1' /*version*/, {
requires : ["base"]
});
@erikfried
erikfried / gist:1067011
Created July 6, 2011 11:05 — forked from remy/gist:350433
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@erikfried
erikfried / alert.js
Created November 28, 2011 21:39
alert
alert("This is just an alert to prove I´ve been executed");
@erikfried
erikfried / example.java
Created February 29, 2012 08:56
Java scala collections comparison
public List<Integer> getContinuousLessThan150DaysOfferIds(List<DbLegacyOffer> list){
List<Integer> retList = new ArrayList<Integer>();
for(DbLegacyOffer offer : list) {
if(offer.isBecomesContinous() && offer.getLength() < 150)
retList.add(offer.getOfferId());
}
return retList;
}
@erikfried
erikfried / Build.scala
Created March 22, 2012 14:25
Play2 build file
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "my_app"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
// Add your project dependencies here,
@erikfried
erikfried / yuiconfigreuse.js
Created October 3, 2012 19:45
Some YUI3 components, e g AutoComplete or Charts, have a lot of config to set up general look-and-feel, that you typically wish to reuse throughout the application. I have not found out a satisfying way to reuse such config. For instance, extending the C
YUI().use('charts', function (Y) {
//Some config that i want to reuse for more or less all charts in my application
var defaultConfig = function () {
return {
categoryType: "time",
axes: {
category: {
labelFormat: "%e %b"
}
},
@erikfried
erikfried / README.markdown
Created March 7, 2011 10:21
shell script to invoke jslint via jsc on Mac OS X

I just realized that there is a rather well hidden javascript interpreter in the mac os x terminal out of the box. /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc See http://www.phpied.com/javascript-shell-scripting/

Then i figured it coud be quite easy to set up a command line util to run jslint from anywhere. Thought i´d share how.

Setup