Skip to content

Instantly share code, notes, and snippets.

Kenneth Skovhus skovhus

Block or report user

Report or block skovhus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@skovhus
skovhus / flow-to-typescript-codemod.sh
Last active Apr 17, 2019
Quick and dirty flow-to-typscript migration codemod
View flow-to-typescript-codemod.sh
#!/bin/sh
#
# This is a super quick and dirty codemod for migration a codebase from Flow to TypeScript.
#
# Step 1:
# npm i -g jscodeshift
# Step 2: rename all .js files to .ts(x)
# find src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
# find storybook -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
# find src/**/components -name "*.ts" -exec sh -c 'mv "$0" "${0%.ts}.tsx"' {} \;
@skovhus
skovhus / proptypes-to-flow-example.js
Last active Apr 10, 2017
PropTypes to Flow blog post
View proptypes-to-flow-example.js
/* 1) Using good old PropTypes */
function Button({ message }) =>
<button>{message}</button>;
Button.propTypes = {
message: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.instanceOf(Message)
]).isRequired,
@skovhus
skovhus / redux-actions-to-flow.py
Created Apr 6, 2017
Annotates redux actions files with some Flow types
View redux-actions-to-flow.py
# Super quick and dirty script to bootstrap our action files with some Flow boilerplate.
import re
import sys
def get_action_constant(l):
m = re.search('= \'(.*)\'', l)
if m:
return m.group(1)
@skovhus
skovhus / tape-to-ava-codemod.js
Last active Aug 14, 2016
Codemod for Tape to AVA
View tape-to-ava-codemod.js
/**
* Codemod for transforming Tape tests into AVA.
*
* jscodeshift -t tape-to-ava-codemod.js my-folder
*
* TODO:
* - [ ] Figure out when to keep `t.end` and when to remove it
* - [ ] rename first param in test callback function, if it is not t
* (and replace usage of identifier in block)
* - [ ] write test and submit to https://github.com/avajs/ava-codemods/issues/5
@skovhus
skovhus / gist:5fcefb38500ef4aa8536
Last active Aug 29, 2015
My Sublime Text 3 packages
View gist:5fcefb38500ef4aa8536
Sublime Text 3 PackageControl https://packagecontrol.io/
Basic:
- Git
- GitGutter
- Markdown Preview
- Pretty JSON
- SideBarEnhancements
- Cucumber
@skovhus
skovhus / Preferences.sublime-settings
Last active Aug 29, 2015
Sublime Text 3 preferences
View Preferences.sublime-settings
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/Solarized Skovhus (SL).tmTheme",
"font_face": "menlo",
"font_size": 10,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
View Solarized (dark - skovhus).tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized (Dark)</string>
View jsonp-in-flask.py
from functools import wraps
from flask import request, current_app, jsonify
def support_jsonp(f):
"""Wraps output to JSONP"""
@wraps(f)
def decorated_function(*args, **kwargs):
result = jsonify(f(*args, **kwargs))
callback = request.args.get('callback', False)
@skovhus
skovhus / Triggers.plist
Created Oct 29, 2012
My QuickSilver Triggers
View Triggers.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>triggers</key>
<array>
<dict>
<key>ID</key>
<string>QSiTunesPlayPauseTrigger</string>
<key>command</key>
@skovhus
skovhus / Blackboard Skovhus Style.tmTheme
Created Oct 29, 2012
My TextMate Theme (Blackboard mod)
View Blackboard Skovhus Style.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Domenico Carbotta</string>
<key>name</key>
<string>Blackboard Skovhus Style</string>
<key>settings</key>
<array>
You can’t perform that action at this time.