Skip to content

Instantly share code, notes, and snippets.

var OldTrigger = $.fn.trigger;
$.fn.trigger = function () {
if (arguments[0] === 'dmp_AD_FETCHER_RESPONDED') {
jQuery('.np_SliderSeek').hide();
return;
}
return OldTrigger.apply(this, arguments);
};
@haruair
haruair / event-sourcing-pattern-in-js-1.js
Last active February 25, 2019 03:59
Event Sourcing Pattern in JS
class AggregateRoot {
apply(event) {
this.handle(event)
return this
}
handle(event) {
var eventName = event.constructor.name
var eventMethod = `apply${eventName}`
@haruair
haruair / gist:5a6e43fd6ca1da5ed9a8d51e7b400835
Last active October 19, 2017 23:44
dotnet core project
mkdir helloworld && cd helloworld
echo "# HelloWorld" > README.md
dotnet new sln -n HelloWorld
mkdir src test
dotnet new angular --output src/HelloWorld.WebApp --name HelloWorld.WebApp
dotnet new xunit --output test/HelloWorld.WebApp.Tests --name HelloWorld.WebApp.Tests
cd test/HelloWorld.WebApp.Tests
@haruair
haruair / es.js
Created August 31, 2017 14:40
event sourcing js practice code
function generatedId() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
)
}
class LocalStorageEventStore {
getStorage() {
var raw = window.localStorage.getItem('event-store')
var data = JSON.parse(raw) || []
<?php
interface FoodInterface
{
}
class FriedChicken implements FoodInterface
{
public function getName()
{
return self::class;
@haruair
haruair / DI.php
Last active April 20, 2017 00:31
small DI classes
<?php
namespace Wattle\DI;
use ReflectionClass;
use Exception;
use Closure;
/**
* Scope Implementation.
*/
# 0 is too far from ` ;)
set -g base-index 1
set -g prefix ^b
setw -g xterm-keys on
set -g default-terminal "screen-256color"
# Automatically set window title
set-window-option -g automatic-rename on
@haruair
haruair / pre-commit-swiftlint.sh
Created December 5, 2016 13:25
Git Client-side pre-commit hook for SwiftLint
#!/bin/bash
#
# hook script for swiftlint. It will triggered when you make a commit.
#
# If you want to use, type commands in your console.
# $ ln -s ../../pre-commit-swiftlint.sh .git/hooks/pre-commit
# $ chmod +x .git/hooks/pre-commit
LINT=$(which swiftlint)
@haruair
haruair / DefaultLayout.swift
Created November 29, 2016 05:23
비스무리하게 구현하면
class DefaultLayout : Layout {
let definitions = [
Definition(PickButton.self, BottomButtonRepresentation.self),
Definition(CameraView.self, FullScreenRepresentation.self),
Definition(OverlayFlashView.self, FullScreenRepresentation.self),
]
}
class Definition {
var elementType : Any?
@haruair
haruair / DefaultLayout.swift
Created November 29, 2016 05:16
당연히 작동 안합니다
class DefaultLayout : Layout {
let definitions = [
(PickButton, BottomButtonRepresentation),
(CameraView, FullScreenRepresentation),
(OverlayFlashView, FullScreenRepresentation),
]
}