Skip to content

Instantly share code, notes, and snippets.

@xfsnowind
xfsnowind / rspack.config.ts
Created December 27, 2023 08:06
rspack config file
require('dotenv').config()
const { join } = require('path')
const rspack = require('@rspack/core')
const { defineConfig } = require('@rspack/cli')
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const {
resolveJSAndTS,
getModuleJSAndTSRules,
plugins: { ignoreMomentLocalesPlugin },

Replace whitespace, with ,

Replace \whitespace with \

Replace , with ,whitespace

Merge duplicated whitespace

the field name and affiliation contains multiple person/organizations' infor | separate it and extract the related infor to multiple records

These are the filter rules which should be applied to all values of field "name". Some rules like "Handle mixed name" is decided, while some others are not.

Merge multiple whitespace

Replace wrong words:

  • fellesorganiasjon -> fellesorganisasjon
  • Bergen Univsersity College -> Bergen University College
  • Samfunnsforsking -> Samfunnsforskning
@xfsnowind
xfsnowind / author-filter-rules.md
Created June 28, 2017 09:05
author filter rules

Author file have several situations:

situations solutions
the field name and affiliation contains multiple person/organizations' infor separate it and extract the related infor to multiple records
the field name contains organization's infor and the field affiliation is not empty extract the related infor to one record
only field name has value, and it contains the multiple persons/organizations' infor separate it and extract the related infor to multiple records
only field name has value, and it contains only one person/organization's name extract the related infor to one record
only field affiliation has value, and it only contains one organization's name normalize the record
? only field affiliation has value, and it only contains one person/organization's name normalize the record
@xfsnowind
xfsnowind / .spacemaces
Last active August 27, 2018 18:16
The configuration of spacemaces
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
@xfsnowind
xfsnowind / download-skam-norsk-subtitle.js
Created December 29, 2016 00:19
last ned disse norske tekstene til den tve serien "Skam" sesong 1-3 og lagre som srt filer
#!/usr/bin/env node
var request = require('request'),
fs = require("fs");
var skamSesongSubtitles = [["1", 'MSUB1912', '16AW', 11],
["2", 'MYNT1500', '16AA', 12],
["3", 'MYNT1520', '16AA', 10]];
// get the subtitle content with given sesong number, episode, url, saving folder and callback function
@xfsnowind
xfsnowind / reserve.clj
Created December 9, 2015 08:42 — forked from eslick/reserve.clj
Simple reservation for multiple worker peers using Datomic
(ns experiment.infra.election
(:use [datomic.api :only [q] :as d])
(:require [experiment.system :as sys]
[experiment.infra.data :as data]
[experiment.infra.protocols :as p]))
;;
;; Reserve - Simple peer coordination mechanism
;;
;; Reservations support multiple peers trying to distribution operations
@xfsnowind
xfsnowind / debounce-use.clj
Last active October 24, 2015 00:03
usage debounce-clj on blog "Debounce and Throttle in Clojure" on 2015/10/24
(def sync-source (chan))
(def sync-sink (debounce sync-source 10000))
(defn handle-event! [event]
(when-let
[handler (case (:type event)
:one-event function-wanna-call
unknown-event)]
(try
(apply handler (:args event))
@xfsnowind
xfsnowind / memoize.clj
Created October 23, 2015 22:46
official standard memoize function
(defn memoize
[f]
(let [mem (atom {})]
(fn [& args]
(if-let [e (find @mem args)]
(val e)
(let [ret (apply f args)]
(swap! mem assoc args ret)
ret)))))
@xfsnowind
xfsnowind / child->parent-trigged-child.js
Created October 23, 2015 22:42
communication from child to parent and triggered by child on blog "React -- Communication between components" on 2014/06/24
// For Parent.js
var Parent = React.createClass({
getInitialState: function () {
return { parentValue: "" };
},
// the callback function is passed to Child as props
passValueFunc: function (para) {
// handle the passed value from Child
},