Skip to content

Instantly share code, notes, and snippets.

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@nichtich
nichtich / EDM-v52-100730.ttl
Created March 9, 2011 16:40
Europeana Data Model v5.2 from http://is.gd/4sX8WC
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://www.europeana.eu/schemas/edm/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix abc: <http://metadata.net/harmony/abc#> .
@prefix DOLCE-Lite: <http://www.loa-cnr.it/ontologies/DOLCE-Lite.owl#> .
@prefix wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix dcmitype: <http://purl.org/dc/dcmitype/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
"""
Sample code to traverse RDF list with RDFLIB.
author: Manuel Salvadores (msalvadores@gmail.com)
rdf containers are a pain in general, quite annoying to handle them.
To get all the authors for a given article like in your case you could do
something like the code I am posting below.
@AlBaker
AlBaker / ExampleGroovySparql.groovy
Created June 27, 2011 05:30
Groovy SPARQL Example
@Grab('com.hp.hpl.jena:jena:2.6.4')
@Grab('com.hp.hpl.jena:arq:2.8.8')
import groovy.sparql.Sparql
// Can also take a Jena model as an argument
def sparql = new Sparql("http://dbpedia.org/sparql")
def query = """
SELECT ?abstract
@wrunk
wrunk / jinja2_file_less.py
Last active September 19, 2023 15:05
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@domoritz
domoritz / wos.php
Created March 10, 2012 19:32 — forked from pol/wos.php
Web of Science API access with ruby, python and php libs
<?php
$auth_url = "http://search.isiknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl";
$auth_client = @new SoapClient($auth_url);
$auth_response = $auth_client->authenticate();
$search_url = "http://search.isiknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl";
$search_client = @new SoapClient($search_url);
$search_client->__setCookie('SID',$auth_response->return);
$search_array = array(
@haf
haf / gist:2843680
Created May 31, 2012 14:19
Get SSH working on Vagrant/Windows/Git

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

# if Util::Platform.windows?
  # raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                       # :port => ssh_info[:port],
                                       # :username => ssh_info[:username],
 # :key_path =&gt; ssh_info[:private_key_path]
@TastyToast
TastyToast / handlebars-truncate-helper.js
Last active April 21, 2021 09:08
Truncate helper for Handlebars.js
Handlebars.registerHelper ('truncate', function (str, len) {
if (str.length > len) {
var new_str = str.substr (0, len+1);
while (new_str.length) {
var ch = new_str.substr ( -1 );
new_str = new_str.substr ( 0, -1 );
if (ch == ' ') {
break;
10.1002 Wiley Blackwell (John Wiley & Sons) 111 River Street Hoboken, NJ 07030 USA
10.1155 Hindawi Publishing Corporation Nasr City Free Zone Cairo, 11816 Egypt
10.1142 World Scientific No 5 Toh Tuck Link 596224 Singapore
10.1111 Wiley Blackwell (Blackwell Publishing) 111 River Street Hoboken, NJ 07030 USA
10.3109 Informa UK (Informa Healthcare)
10.1007 Springer-Verlag Van Godewijckstraat 30 Dordrecht, GX 3311 The Netherlands
10.1016 Elsevier 360 Park Ave South New York, NY 10010 USA
10.3402 Co-Action Publishing Haggebyholmsvagen 5 Balsta, 74694 Sweden
10.1017 Cambridge University Press The Edinburgh Bldg Shaftesbury Rd Cambridge, CB2 2RU UK
10.1080 Informa UK (Taylor & Francis) 4 Park Square Milton Park, Abingdon, OXON OX14 4RN UK
prefix publisher journals dois
10.12679 0 0
10.7579 123Doc Education 0 0
10.3731 21st Century COE Program (Toplogical Science and Technology) 1 40
10.5775 A. I. Rosu Cultural Scientific Foundation Fundatia cultural-stiintifica A. I. Rosu 1 80
10.4037 AACN Publishing 2 766
10.1306 AAPG/Datapages 4 21817
10.3183 AB Svensk Papperstidning 1 1550
10.5769 ABEAT - Associacao Brasileira de Especialistas em Alta Tecnologia 1 57
10.7597 ACOPIOS - Revista Iberica de Mineralogia 1 9