Skip to content

Instantly share code, notes, and snippets.

View steffen's full-sized avatar
🎯
Focusing

Steffen Hiller steffen

🎯
Focusing
View GitHub Profile
@steffen
steffen / index.js
Last active July 17, 2020 10:12
GitHub Login OAuth example with Node.js and Express
const { createOAuthAppAuth } = require("@octokit/auth-oauth-app")
const express = require('express')
const app = express()
const port = 3000
const clientId = '123'
const clientSecret = '456'
const authUrl = `https://github.com/login/oauth/authorize?client_id=${clientId}&redirect_uri=http://localhost:3000/login`
const body = `<button onclick="location.href='${authUrl}'">Login with GitHub</button>`
@steffen
steffen / git-du
Created May 17, 2019 07:43 — forked from peff/git-du
git-du script
#!/usr/bin/perl
#
# Generate a listing of all paths ever used in the repository, along with the
# disk space used by the path throughout the entire history. Note that sizes
# for trees are cumulative; they include the sizes of all of the paths below
# them, in addition to the tree storage itself. All sizes are in bytes, and
# reflect git's delta and zlib compression.
#
# One caveat is that this is just the _current_ on-disk size. The on-disk size
# of each object may change if git repacks and chooses different delta bases,
@steffen
steffen / MainViewController.js
Created July 10, 2015 15:35
ViewController communication via ViewController events
Ext.define('MyApp.controller.MainViewController',{
extend: 'Ext.app.ViewController',
alias: 'controller.main',
listen: {
controller: {
'*': {
userupdate: 'updateUserAvatar'
}
}
},
@steffen
steffen / MainViewController.js
Last active November 26, 2019 13:30
ViewController communication via Ext.GlobalEvents
Ext.define('MyApp.controller.MainViewController',{
extend: 'Ext.app.ViewController',
alias: 'controller.main',
listen: {
global: {
userupdate: 'updateUserAvatar'
}
},
updateUserAvatar: function(userdata) {
/* Update the user avatar. */
@steffen
steffen / gist:1021849
Created June 12, 2011 18:25
config.js
cluster(server)
.set('workers', 4)
.set('socket path', '/var/run')
.use(cluster.debug())
.use(cluster.cli())
.use(cluster.stats())
.use(cluster.repl(8888))
.listen(3000)
Ext.override(Ext.util.Route, {
constructor: function(config) {
Ext.apply(this, config, {
conditions: {}
});
/*
* The regular expression we use to match a segment of a route mapping
* this will recognise segments starting with a colon,
* e.g. on 'namespace/:controller/:action', :controller and :action will be recognised
#!/usr/bin/env ruby
# ABOUT:
# Migrates your Simple Localization (http://simple-localization.arkanis.de/) language file to
# Rails built-in i18n language file structure.
# IMPORTANT:
# If you want your active records model and attributes keys
# and your "app" keys to be sorted alphabetically, use Ruby 1.9
# since it supports sorted hashes
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
[user]
name = MY NAME
email = MY EMAIL
[core]
editor = mate -w
[alias]
st = status
ci = commit
br = branch
co = checkout