Skip to content

Instantly share code, notes, and snippets.

@pgericson
pgericson / README.md
Last active November 1, 2017 00:40
Supertest+Jest - It jest don't work

Output that shows that mocha runs the tests correctly and jest don't

only one should pass

Jest (pass both)

$ jest
 PASS  ./test.js

 jest vs mocha in supertest
 ✓ should not work (40ms)
@pgericson
pgericson / Dockerfile
Created March 30, 2016 15:48
Docker setup for rails 4.0+ app with empty bundle container for caching with Vagrant for OS X
FROM ruby:2.2.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
ENV APP_HOME /myapp
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ENV BUNDLE_PATH /box
ADD . $APP_HOME
@pgericson
pgericson / garmin-connect-spm.js
Last active March 10, 2016 12:24
Garmin Connect add approximate Strokes Per Minute (SPM)
var col = 11; // this is the column before it will be inserted
$('#intervals-table table thead').find('th').eq(col).after('<td>SPM</td>');
$('#intervals-table table tbody').find('tr').each(function(){
var strokes = parseInt($(this).find('td').eq(12).text().trim());
//console.log(strokes);
var timeString = $(this).find('td').eq(5).text().trim();
//console.log(timeString);
var regex = /(\d{1,2}):(\d{2})/g;
var result = regex.exec(timeString);
var minutes = parseInt(result[1]);
@pgericson
pgericson / autoxrandr
Last active August 29, 2015 14:18
auto config multimonitor setup for i3
#!/bin/bash
echo 'Monitor-Auto-Setup script is starting...'
## this should be launched from e.g. ~/.i3/config file.
## this is a setup with one laptop LVDS1 and 2 monitors, one HDMI and one VGA.
displays="$(xrandr -q)"
if [[ $displays =~ VGA[0-9][[:space:]]connected && $displays =~ HDMI[0-9][[:space:]]connected ]]; then
echo '=== LAPTOP IS PROBABLY DOCKED w/ TWO DISPLAYS ==='
xrandr --verbose --output LVDS1 --off;
@pgericson
pgericson / prefixes.ttl
Last active August 29, 2015 14:06
The long list of Semantic Web RDF prefixes
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@pgericson
pgericson / find_current_countries_currency.rq
Created April 17, 2014 07:22
dbpedia find current countries' currency
select ?country ?currency ?isocode where {
?country a <http://dbpedia.org/ontology/Country> .
?currency a dbpedia-owl:Currency .
?country ?p ?currency .
?currency dbpprop:isoCode ?isocode
FILTER NOT EXISTS { ?country dbpedia-owl:dissolutionYear ?disyear }
} LIMIT 1000
@pgericson
pgericson / gender_first_names.csv
Last active May 11, 2020 17:28
Approved first names in Denmark, M = Male, F = Female, U = Unisex, source: http://www.familiestyrelsen.dk/samliv/navne/soeginavnelister/godkendtefornavne/advanced/
Abiola U
Acelya U
Ada U
Adama U
Addis U
Addison U
Adi U
Adian U
Aezha U
Agne U
@pgericson
pgericson / tpl-railsapp.rb
Created January 17, 2011 09:24 — forked from martinisoft/tpl-cukeapp.rb
Install the most common rails things for a new project
## Rails App Template
## Updated for Rails 3.0.3
## Forked on 14-01-11
## Updated on 14-01-11
## Run using $ rails new [appname] -JT -m tpl-railsapp.rb
## Gems
# Devise for security
module Curl
class Easy
def self.performe
puts "TEST method"
end
puts "easy"
attr_accessor :body_str, :header_str, :response_code
end
end
set nocompatible " We're running Vim, not Vi!
set ic " Disable case sensitivity
nmap <F7> :NERDTreeToggle<CR>
if has("gui_running")
set guioptions-=T
set background=dark
colorscheme koehler
endif
" http://weblog.jamisbuck.org/2008/11/17/vim-follow-up