Skip to content

Instantly share code, notes, and snippets.

View schmkr's full-sized avatar

Alwin Schoemaker schmkr

View GitHub Profile
@schmkr
schmkr / README.md
Last active July 24, 2020 10:26
Zoneless Angular App

Example of running an Angular app without NgZone

Angular app that is running without NgZone. Triggering change-detection happens like this:

merge(
	fromEvent(document, 'click'),
	fromEvent(document, 'mousemove'),
	fromEvent(document, 'keydown'),
	fromEvent(document, 'scroll'),
@schmkr
schmkr / example.js
Last active June 23, 2020 13:03
angular ui router 404 without redirect
angular.module("app.example", ["ui.router"])
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider.state("404", {
templateUrl: "errors/notfound.tpl.html",
data: {
authorizationRequired: false,
permissionsRequired: [],
bodyClass: "error"
}
@schmkr
schmkr / README.md
Created August 3, 2018 12:03
CodeceptJS helper to check for emails in Mailcatcher

CodeceptJS helper for Mailcatcher

This is a helper for CodeceptJS to check for emails sent to MailCatcher during a test.

usage

  • Download mailcatcher.js to your project that has CodeceptJS and make sure to add got as npm dependency (or replace the usages of got in this helper by your preferred http library).
  • Make sure the application you're testing is sending the emails to a mailcatcher instance.

In your codecept.config.js add something like this to your helpers configuration:

#tab1:checked ~ div .na-keuze #eindcijfer1,
#tab2:checked ~ div .na-keuze #eindcijfer1,
#tab2:checked ~ div .na-keuze #eindcijfer2,
#tab3:checked ~ div .na-keuze #eindcijfer1,
#tab3:checked ~ div .na-keuze #eindcijfer2,
#tab3:checked ~ div .na-keuze #eindcijfer3,
#tab4:checked ~ div .na-keuze #eindcijfer1,
#tab4:checked ~ div .na-keuze #eindcijfer2,
#tab4:checked ~ div .na-keuze #eindcijfer3,
#tab4:checked ~ div .na-keuze #eindcijfer4,
@schmkr
schmkr / keybase.md
Last active February 5, 2016 10:28

Keybase proof

I hereby claim:

  • I am schmkr on github.
  • I am schmkr (https://keybase.io/schmkr) on keybase.
  • I have a public key ASAqVESetfmN3uI8p94Qy_0yg1RPbDwQcDQhbiZdP9zUzgo

To claim this, I am signing this object:

@schmkr
schmkr / PrivateMethodCallerTrait
Created October 2, 2013 19:21
Get access to private methods (and properties), usefull for testing.
<?php
trait PrivateMethodCallerTrait {
protected function callPrivateMethod($object, $methodName, $args = array()) {
$fn = function($methodName, $args) {
return call_user_func_array(array($this, $methodName), $args);
};
$privateAccessor = $fn->bindTo($object,$object);
@schmkr
schmkr / Readme.md
Last active December 22, 2015 17:39
Example of Composer Satis with a deep SVN structure

Example of output when running:

bin/satis build satis.json ./web -vvv

Current output

Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Scanning packages
@schmkr
schmkr / smtp_catcher.php
Last active December 11, 2015 17:28
Script to catch mails on development machines
#!/usr/bin/env php
<?php
# create a filename for this email
list($ms, $time) = explode(' ', microtime());
$filename = '/tmp/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.txt';
# write the email contents to the file
$email_contents = fopen('php://stdin', 'r');
$fstat = fstat($email_contents);
@schmkr
schmkr / bash-history-top10.sh
Created January 14, 2013 09:31
List your bash history top 10
cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 10
@schmkr
schmkr / PasswordRandomValue.js
Created November 5, 2015 12:08
Paw extension for generating random passwords.
(function() {
var PasswordRandomizerDynamicValue,
charset = [
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"0123456789",
"!@#$%ˆ&*()-=_+{}[]|<>,.?/"
].join('');
PasswordRandomizerDynamicValue = function() {