Skip to content

Instantly share code, notes, and snippets.

@MW3000
MW3000 / gist:f2db4d76a7af2027ba73
Created September 25, 2014 11:12
Marcus Zarra’s logging macros.
// Marcus Zarra's logging macros.
#ifdef DEBUG
#define DLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#define DCLog(...) NSLog(@"%@", [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) {NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__]);[[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__];}
#else
#define DLog(...) do { } while (0)
#define DCLog(...) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
@MW3000
MW3000 / README.md
Last active February 20, 2016 18:45
D3 interactive histogram

D3 interactive histogram

Das Diagramm zeigt das Tweetaufkommen zum Hashtag #Landesverrat am 31. Juli 2015 von 9:30 Uhr bis 15:30 Uhr.

Ein Klick auf ein Portrait zeigt das Tweetaufkommen in Verbindung mit dem Namen des jeweiligen Akteurs.

Bildrechte

@MW3000
MW3000 / index.html
Created June 18, 2016 06:59 — forked from bunkat/index.html
Swimlane Chart using d3.js
<!--
The MIT License (MIT)
Copyright (c) 2013 [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@MW3000
MW3000 / github_api_doi.md
Created July 28, 2016 12:06 — forked from arfon/github_api_doi.md
Building a data archiving service using the GitHub API, figshare and Zenodo

Building a data archiving service using the GitHub API, figshare and Zenodo

Over the past couple of weeks we've seen a couple of great examples of service integrations from figshare and Zenodo that use the GitHub outbound API to automatically archive GitHub repositories. While the implementation of each solution is likely to be somewhat different I thought it might be useful to write up in general terms how to go about building such a service.

In a nutshell we need a tool that does the following:

  • Authenticates against the GitHub API
  • Configures an outbound API endpoint for repository events to be posted to
  • Respond to a GitHub repository event by grabbing a copy of the code
  • Issues a DOI for the code bundle
@MW3000
MW3000 / _tint-and-shade.scss
Created January 5, 2017 14:21
Tint and Shade functions for Sass
// Add percentage of white to a color
@function tint($color, $percent){
@return mix(white, $color, $percent);
}
// Add percentage of black to a color
@function shade($color, $percent){
@return mix(black, $color, $percent);
}
@MW3000
MW3000 / README.md
Created September 11, 2017 09:05
Search for filenames and file descriptions in DSpace

Search for filenames and file descriptions in DSpace

Out of the box discovery in DSpace 6 works quite well. But it does not include filenames and file descriptions in the search index.

As we plan to allow research data publications on our repository, there will be publications with many files (as opposed to text publications which usually consist of only one pdf) and it would be nice to be able to search for filenames and file descriptions.

Add additional fields and values to Solr index

Sometimes extending DSpace turns out to be very easy and straightforward, albeit not very well documented.

To add fields and values to the discovery index, just create a new implementation of the SolrServiceIndexPlugin class and add your fields and values to the document in the additionalIndex method:

@MW3000
MW3000 / customViewPlayground.swift
Created April 3, 2018 11:18
NSView Subclass Template Playground (Swift 4.1, Xcode 9.3)
//: Playground - noun: a place where people can play
// Swift 4.1, Xcode 9.3
import Cocoa
import PlaygroundSupport
class CustomView: NSView {
override func draw(_ dirtyRect: NSRect) {
// Add your drawing code here.
@MW3000
MW3000 / XML_breaker.py
Created November 19, 2018 09:39 — forked from nicwolff/XML_breaker.py
Python script to break large XML files
import os
import sys
from xml.sax import parse
from xml.sax.saxutils import XMLGenerator
class CycleFile(object):
def __init__(self, filename):
self.basename, self.ext = os.path.splitext(filename)
self.index = 0
@MW3000
MW3000 / tot.sh
Last active November 27, 2020 19:37 — forked from chockenberry/tot.sh
A shell script for Tot
#!/usr/bin/env bash
# Fork of zrzk's tot.sh https://gist.github.com/zrzka/5948256ac72c3f3820aebff1fb4b1b70
# which is a fork of gruber's tot.sh https://gist.github.com/gruber/b18d8b53385fa612713754799ed4d0a2
# which is a fork of chockenberry's tot.sh https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23
# Add possibility to access dots by default color names in addition to numbers and
# access first empty dot by 'empty' in addition to 0.
# Exit immediately if a pipeline returns a non-zero status.