Skip to content

Instantly share code, notes, and snippets.

View paluchas's full-sized avatar
🎯
Focusing

Sebastian Pałucha paluchas

🎯
Focusing
  • Durham/York, UK
View GitHub Profile
require 'csv'
require 'faraday'
require 'faraday_middleware'
require 'pry'
# Process DOIs from Altmetrics CSV file
altmetric_csv_file = 'Altmetric - Mentions - University of York - 2019-04-16.csv'
# Store all processed unpaywall responses in new csv file
unpaywall_csv_file = 'Unpaywall_York.csv'
@paluchas
paluchas / gist:674246429cd98d47dcb7adb370b59063
Created April 4, 2018 15:04
Fedora 4.7.5 namespace issue error log. A CND file has been changed over the time and once new records have been created Tomcat failed to restart.
ERROR 06:25:50.697 (RepositoryNodeTypeManager) Node types were read from the system content, and appear to be inconsistent or invalid: repo
org.modeshape.jcr.value.ValueFormatException: Error converting "ns010:OriginalFile" from String to a Name
at org.modeshape.jcr.value.basic.NameValueFactory.create(NameValueFactory.java:157)
at org.modeshape.jcr.value.basic.NameValueFactory.create(NameValueFactory.java:46)
at org.modeshape.jcr.cache.document.DocumentTranslator.childReferenceFrom(DocumentTranslator.java:966)
at org.modeshape.jcr.cache.document.ImmutableChildReferences$Medium.<init>(ImmutableChildReferences.java:220)
at org.modeshape.jcr.cache.document.ImmutableChildReferences.create(ImmutableChildReferences.java:53)
at org.modeshape.jcr.cache.document.DocumentTranslator.getChildReferences(DocumentTranslator.java:887)
at org.modeshape.jcr.cache.document.LazyCachedNode.getChildReferences(LazyCachedNode.java:449)
at org.modeshape.jcr.SystemContent
@paluchas
paluchas / Orcid.php
Created June 26, 2017 14:17
Our PHP code snippet used to set up ORCID API scopes as well as customise an OAuth form.
/**
* Generic connector to route to create initiate Orcid Auth process.
* While we are only using the app to read data (in the intial phase)
* we need all the scopes: /read-limited, /activities/update and /person/update.
*
* @return redirect to authorization URL
*/
public function connect()
{
$this->oauth->setClientId(config('orcid.client_id'))
@paluchas
paluchas / tmux-cheatsheet.markdown
Created May 25, 2017 10:37 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@paluchas
paluchas / css_resources.md
Created January 31, 2017 15:23 — forked from Przemol/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@paluchas
paluchas / rails_resources.md
Created January 31, 2017 15:22 — forked from Przemol/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@paluchas
paluchas / javascript_resources.md
Created January 31, 2017 15:21 — forked from Przemol/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
# Register DOI metadata first, pass metadata as external @file
curl -v -i --basic -u 'BL.USER:PASSXXX' \
--header 'Content-Type:application/xml;charset=UTF-8' \
--data-binary @datacite-example-full-v3.1.xml \
--request POST https://test.datacite.org/mds/metadata
# Register DOI with its landing page, pass parameters in external via @file
curl -v -i --basic -u 'BL.USER:PASXXX' \
--header 'Content-Type:text/plain;charset=UTF-8' \
--data-binary @example-full-du-test.doi \
require 'httparty'
# Based on
class Datacite
include HTTParty
base_uri 'https://test.datacite.org'
# PRODUCTION # base_uri 'https://mds.datacite.org'
def initialize
@auth = {:username => Rails.application.secrets.mduser, :password => Rails.application.secrets.mdpassword}
[vagrant@vagrant-centos70 af-tutorial]$ rails console
Loading development environment (Rails 4.1.8)
irb(main):001:0> class DublinCoreAsset < ActiveFedora::Rdf::Resource
irb(main):002:1> property :title, predicate: RDF::DC.title
irb(main):003:1> end
TypeError: superclass must be a Class (ActiveSupport::Deprecation::DeprecatedConstantProxy given)
from (irb):1
from /home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
from /home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
from /home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'