Skip to content

Instantly share code, notes, and snippets.

View danieloskarsson's full-sized avatar

Daniel Oskarsson danieloskarsson

View GitHub Profile

Firing up LaTex on macOS 🔥

As I'm writing this small tutorial, I assume you've read my previous one about setting up macOS, so if for any tool I'll use without explanation, look to that other article.

MacTex

The full version IS NOT MANDATORY, as in the tutorial that follows I installed the smaller version of MacTeX and proceded installing every needed dependency. Installing the complete package is about ~3.5GB of download and ~5GB on disk, the smaller one is just about 80MBs.

Click here to download the complete version or here to download the smaller version.

Gnuplot

class If<T>(val any: T?, private val i: (T) -> Unit) {
infix fun Else(e: () -> Unit) {
if (any == null) e()
else i(any)
}
}
Usage:
If (nullableString) {
// ...
@Test @Transactional @Rollback fun getZeroBookings() = get("/${organization1.slug}/${resource1.slug}/2020/04/1/1", status().isOk, jsonPath("$", hasSize<Resource>(0)))
@Test @Transactional @Rollback fun getThreeBookings() = get("/${organization1.slug}/${resource1.slug}/2020/04/1/7", status().isOk, jsonPath("$", hasSize<Resource>(3)))
@Test @Transactional @Rollback fun getBookingsWithBadDate() = get("/${organization1.slug}/${resource1.slug}/2020/04/31/7", status().isBadRequest)
// Wrapper around MockMvc
private fun post(url: String, model: Any?, vararg matchers: ResultMatcher) = test(POST, url, model, *matchers)
private fun patch(url: String, model: Any?, vararg matchers: ResultMatcher) = test(PATCH, url, model, *matchers)
private fun get(url: String, vararg matchers: ResultMatcher) = test(GET, url, null, *matchers)
@SuppressLint("StaticFieldLeak")
private class JsonTask extends AsyncTask<String, String, String> {
private HttpURLConnection connection = null;
private BufferedReader reader = null;
protected String doInBackground(String... params) {
try {
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
rename 's/\D+?(?=\.mp3)//g' *.mp3
while read line; do echo "$line"; done < links
for i in {1..24}; do $i; done

Första terminen

  • DNA151 Informationssystem - modellering, A-nivå, 7.5 hp
  • PAA151 Procedurell programmering, A-nivå, 7.5 hp
  • BOX121 Informationskompetens, A-nivå, 1.5 hp
  • KBA141 Människa-datorinteraktion - introduktion, A-nivå, 7.5 hp
  • ISA131 Introduktion till datavetenskap, A-nivå, 7.5 hp

Andra terminen

// ==UserScript==
// @name ContextFreeGhost
// @version 1
// @updateURL https://gist.githubusercontent.com/danieloskarsson/d60a905c1f731fc63316cd61697ed4e3/raw/
// @require https://rawgit.com/danieloskarsson/ContextFreeLib/master/js/contextfreegrammar.js
// @match http://localhost:2368/ghost*
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
#!bin/bash
# Syntax: curl -sL https://gist.github.com/danieloskarsson/6eae13217f8eb84954689dc18870ea4e/raw/ | sudo -E bash
# Based on: https://docs.ghost.org/v2/docs/install
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash
RUNLEVEL=1 apt-get install -y nginx
rm /etc/nginx/sites-enabled/default
service nginx start
apt-get install -y nodejs

Functions

Function Target passed as Returns Function type
also it Target Extension
apply this Target Extension
let it Block return value Extension
run this Block return value Extension
with this Block return value Regular

Första terminen

  • IT118G-Webbutveckling - datorgrafik G1N, 7,5 hp
  • IT108G-Webbutveckling - webbplatsdesign G1N, 7,5 hp
  • IT120G-Grundläggande programmering med C++ G1N, 7,5 hp
  • IT111G-Introduktion till User Experience Design G1N, 7,5 hp

Andra terminen