Skip to content

Instantly share code, notes, and snippets.

View HenriBeck's full-sized avatar
💭
💻

Henri Beck HenriBeck

💭
💻
View GitHub Profile
@HenriBeck
HenriBeck / authentication.js
Last active March 9, 2017 00:08
Feathers authentication
import auth from 'feathers-authentication';
import SteamStrategy from 'passport-steam';
export default function authentication() {
const that = this;
const options = {
secret: 'supersecret',
cookie: {
enabled: true,
name: 'feathers-jwt',
@HenriBeck
HenriBeck / plugin.js
Last active October 4, 2017 21:27
TF2Center remove ads
// ==UserScript==
// @name TF2Center remove ads
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove the ads from tf2center without getting redirected to /adblock
// @author Henri Beck (kampfkeks)
// @match https://tf2center.com/*
// @grant none
// ==/UserScript==
firstDuplicate :: [Int] -> Int
firstDuplicate xs = checkDuplicates xs []
checkDuplicates :: [Int] -> [Int] -> Int
checkDuplicates (x:[]) f = if elem x f then x else -1
checkDuplicates (x:xs) f = if elem x f then x else checkDuplicates xs (x:f)
@HenriBeck
HenriBeck / server.js
Created March 10, 2018 11:27
Schreiben und Lesen von Dateien
// Importieren des FileSystem module
const fs = require('fs');
// Zum lesen einer Datei:
const datei = fs.readFileSync(pfad, 'utf-8');
// Zum schreiben in eine Datei:
// Hierbei wird die komplette Datei überschrieben!
fs.writeFileSync(pfad, neuerContent, 'utf-8');
public class Grp45_ueb01 {
public static void main(String[] args) {
final int MIN = -1000;
final int MAX = 25;
final int DIGIT_COUNT = getDigitCount(MAX);
for (int i = MIN; i <= MAX; i++) {
boolean isSmithNumber = Grp45_ueb01.isSmithNumber(i);
boolean isFermatNumber = Grp45_ueb01.isFermatNumber(i, 0);
boolean isCatalanNumber = Grp45_ueb01.isCatalanNumber(i, 0);
@HenriBeck
HenriBeck / react-jss.js
Created July 6, 2018 17:15
React JSS Typings
// @flow strict-local
import {
type ComponentType,
type ElementConfig
} from 'react';
import type Jss from '../../packages/webapp/node_modules/jss/src/Jss';
import type SheetsRegistry from '../../packages/webapp/node_modules/jss/src/SheetsRegistry';
import { type generateClassName } from '../../packages/webapp/node_modules/jss/src/types/jss';
String t() {
try {
return "try";
} finally {
return "finally";
}
}
void main() {
print(t());
abstract class State {}
class StateA implements State {
StateA({this.name = "Hello"});
final String name;
}
class StateB implements State {}
class StateHandlerNotWorking {
abstract class State {}
class StateA implements State {}
final state = StateA();
void main() {
print(state is State);
}
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: MyApp(),
));
}
class MyApp extends StatefulWidget {
@override