Skip to content

Instantly share code, notes, and snippets.

View felixjung's full-sized avatar

Felix Jung felixjung

View GitHub Profile
@felixjung
felixjung / index.js
Created June 13, 2018 06:04
Next.js testing circuit production build
import { ThemeProvider } from 'emotion-theming';
import { Text, Heading } from '@sumup/circuit-ui';
import { standard } from '@sumup/circuit-ui/themes';
export default () => <ThemeProvider theme={standard}><div>
<Heading>Hello</Heading>
<Text>Welcome to Next.js</Text>
</div></ThemeProvider>
@felixjung
felixjung / javascript-es2015.snippets
Created December 3, 2015 14:58
Some ES2015 snippets for UltiSnips
extends javascript
priority -60
snippet imp "import { ... } from ..." b
import ${1:\{ ${2:export} \}} from '${0:library}';
endsnippet
snippet impl "import * as ... from ..." b
import * as ${1:alias} from '${0:library}';
@felixjung
felixjung / snakeToCamelCase.js
Created October 23, 2015 10:04
ES6 module to recursively convert snake case keys in an object to camel case using lodash.
'use strict';
import 'lodash';
export default function (object) {
let camelCaseObject = _.cloneDeep(object);
// Convert keys to camel case
camelCaseObject = _.mapKeys(camelCaseObject, (value, key) => {
return key.replace(/(_\w)/, match => match[1].toUpperCase());
x = c(2.8, 1.2, 2.1, 1.6, 1.5, 4.6, 3.6, 2.1, 6.5, 4.6, 3.0, 1.3, 4.2)
y = c(9.4, 10.4, 10.8, 10.5, 18.4, 11.1, 2.6, 8.8, 5.0, 21.5, 6.7, 2.5, 5.6)
countries = c("Belgium", "Denmark", "France", "GB", "Ireland", "Italy", "Luxembourg", "Holland", "Portugal", "Spain", "USA", "Japan", "Germany")

Keybase proof

I hereby claim:

  • I am felixjung on github.
  • I am felixjung (https://keybase.io/felixjung) on keybase.
  • I have a public key whose fingerprint is 8AC5 2600 8E2C CBC3 5775 B7D6 336D FEA2 1F3B 8864

To claim this, I am signing this object:

@felixjung
felixjung / gist:882cc8cfd1b2d91360f4
Created October 27, 2014 16:33
Database migration error
== 20140907220153 SerializeServiceProperties: migrating =======================
-- add_column(:services, :properties, :text)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Duplicate column name 'properties': ALTER TABLE `services` ADD `properties` text/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:301:in `query'
/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:301:in `block in execute'
/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
@felixjung
felixjung / .ctags
Created September 1, 2014 14:25
Adding languages to crags
# Definitions for R
--langdef=R
--langmap=r:.R.r
--regex-R=/^[ \t]*"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*<-[ \t]function/\1/f,Functions/
--regex-R=/^"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*<-[ \t][^f][^u][^n][^c][^t][^i][^o][^n]/\1/g,GlobalVars/
--regex-R=/[ \t]"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*<-[ \t][^f][^u][^n][^c][^t][^i][^o][^n]/\1/v,FunctionVariables/
# Definitions for UltiSnips
--langdef=snippets
--langmap=snippets:.snippets
# Load library files
include("lib/parallel.jl")
# Set number of workers
setprocs(2)
# Load remaining source onto all parallel processes
require("lib/DataIO.jl")
require("lib/IntensityFunctions.jl")
@felixjung
felixjung / parallel.jl
Created June 16, 2014 12:37
Parallel for loop in Julia
# Prepare parallel computing
n_cpu_reserve = 4 # Number of CPUs not to use
n_cpu = length(Sys.cpu_info()) # Obtain number of CPUs
n_workers = n_cpu - n_cpu_reserve # Set number of CPUs for computation
addprocs(n_workers - length(workers())) # Add additional CPUs if necessary
# Create a standard array for our task
my_array = dzeros((1000, 1000), workers(), [1, length(workers())])
@parallel for i = 1:size(my_array, 1)

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname