Skip to content

Instantly share code, notes, and snippets.

View sebcode's full-sized avatar

Sebastian Volland sebcode

View GitHub Profile
@sebcode
sebcode / a.php
Last active February 19, 2024 15:59
test
<?php
echo "Hello World!";
@sebcode
sebcode / flowtest.js
Last active June 28, 2017 13:33
testfile for vim-javascript/misc-flow-fixes
// [1]
const fetch = (
a: string = '',
b: Object = {},
//^
) => { }
function fetch2(
a: string = '',
b: Object = {},
) {}
@sebcode
sebcode / gist:4a43760ab4abaf078f987f1dd94d4178
Created April 6, 2017 18:17
Replace @autoBind decorator with class instance properties
// https://github.com/andreypopp/autobind-decorator
// https://github.com/facebook/codemod
// Example replacement:
// - @autobind onClick(e: SyntheticEvent) {
// + onClick = (e: SyntheticEvent) => {
codemod -m -d . --extensions js \
'@autobind\ ([a-zA-Z0-9]+)\(([^)]*)\)' \
'\1 = (\2) =>'
@sebcode
sebcode / tasks.js
Created March 17, 2017 18:28
nodejs: Execute multiple tasks in parallel
#!/usr/bin/env node
const async = require('async')
const numTasks = 10
const numParallel = 4
function doTask(i) {
console.log(`${i} start`)
return new Promise((resolve, reject) => {
@sebcode
sebcode / openTermCommand.js
Created March 12, 2017 14:38
JXA: Programmatically open a new iTerm tab with a specified command
#!/usr/bin/osascript -l JavaScript
// Open a new iTerm tab with a specified command.
// Usage example: ./openTermCommand.js '/usr/local/bin/vim /tmp/test.txt'
function run(argv) {
const iTerm = Application('iTerm')
iTerm.includeStandardAdditions = true
iTerm.activate()
@sebcode
sebcode / uploadFile.js
Created March 6, 2017 13:30
upload file with nodejs
const fs = require('fs')
const http = require('http')
const uploadFile = 'uploadMe.txt'
const req = http.request({
hostname: 'localhost',
port: 8080,
path: '/uploadtest',
method: 'PUT',
import Cocoa
let queue = Cocoa.OperationQueue()
let sema = DispatchSemaphore.init(value: 0)
queue.addOperation {
print("T1 Wait")
queue.addOperation {
@sebcode
sebcode / ssh-tunnel-mini-howto.md
Last active July 8, 2016 10:47
SSH Tunnel mini-HOWTO

SSH Tunnel Mini Howto

Local to Remote (-L)

-L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.

Use case: Make firewalled remote web server accessible from local machine

@sebcode
sebcode / touchevents.html
Created May 22, 2011 13:14
example on how to handle mouse and touch events - http://sebcode.github.com/touchevents/
<!doctype html>
<title>touchevents</title>
<canvas id="canvas" width="500" height="300"></canvas>
<script>
function isTouchDevice() {
var el = document.createElement('div')
el.setAttribute('ongesturestart', 'return;')
@sebcode
sebcode / fn.xsl
Created May 22, 2011 13:05
xslt function
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://exslt.org/functions"
xmlns:my="http://example.com"
exclude-result-prefixes="fn my">
<xsl:output method="xml"/>
<fn:function name="my:test">
<fn:result select="'result123'"/>
</fn:function>