Skip to content

Instantly share code, notes, and snippets.

View rmorrise's full-sized avatar

Russell Morrisey rmorrise

  • Corporation Service Company
  • Wilmington, DE
View GitHub Profile
@itsTeknas
itsTeknas / number-to-words.pipe.ts
Created November 12, 2017 06:44
An Angular 4 pipe to convert a number to an equivalent words representation for Indian Rupees.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'numberToWords'
})
export class NumberToWordsPipe implements PipeTransform {
a = [
'',
'one ',
@dpneumo
dpneumo / Docker_User_NameSpaces_setup.md
Last active September 11, 2019 17:00
Setup User Namespaces for docker on RHEL/Centos 7.3

On CentOS 7.3 with Kernel Version: 3.10.0


1. Allow filesystem support for namespaces: xfs partition: format with ``` mkfs.xfs -m crc=1 -n ftype=1 ``` The current CentOS 7 does this by default.
1. Setup a project
2. Add groovy SDK support:
https://www.bonusbits.com/wiki/HowTo:Add_Groovy_SDK_to_IntelliJ_IDEA
3. Download http://(yourjenkinsurl)/job/(yourpipelinejob)/pipeline-syntax/gdsl
- this will give you the .gdsl file - download this to the src folder of your project.
4. Finally follow this step - right click on the src folder -> Mark directory as -> Sources Root
@kekru
kekru / register Hibernate EventListener in Spring.md
Created September 22, 2016 16:09
Register a Hibernate Envers EventListener in Spring Boot (Hibernate 4, Hibernate 5)

Hibernate 4 introduced a new Audit API for event listening.
org.hibernate.envers.event.AuditEventListener was replaced by org.hibernate.event.spi.*, for example org.hibernate.event.spi.PostDeleteEventListener.

First create your custom listener. Example: You want do disable auditing for delete operations.

import org.hibernate.envers.event.spi.EnversPostDeleteEventListenerImpl;
import org.hibernate.event.spi.PostDeleteEvent;

public class MyAuditListener extends EnversPostDeleteEventListenerImpl {
@CaptainOfFlyingDutchman
CaptainOfFlyingDutchman / external_configuration_in_grails_3.md
Last active September 23, 2019 09:19
Enable external configuration in Grails 3

External configuration in Grails 3


Working on Grails 3 I realized that I no longer can specify external configuration using the standard grails.config.locations property in Config.groovy file.

Reason is obvious! There is no Config.groovy now in Grails 3. Instead we now use application.yml to configure the properties. However, you can't specify the external configuration using this file too!

What the hack?

Now Grails 3 uses Spring's property source concept. To enable external config file to work we need to do something extra now.

@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active March 24, 2025 20:20
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@ozh
ozh / git cherry-pick within a pull request.md
Last active January 6, 2025 03:16
git cherry-pick within a pull request

1. Create new branch:

git checkout -b otherrepo-master master

2. Get the contents of the PR

git pull https://github.com/otherrepo/my-repo-name.git master
@antonarhipov
antonarhipov / gist:15be2f6a868dd0f82b72
Last active July 3, 2017 17:46
Setting up XRebel for Grails 3
//in build.gradle:
project.afterEvaluate {
for (Task task : project.getTasks()) {
if (task instanceof JavaExec) {
(task as JavaExec).jvmArgs "-javaagent:xrebel.jar"
}
}
}
@mattpodwysocki
mattpodwysocki / eventsource.js
Last active May 7, 2025 11:05
Adding support for server-sent events for RxJS
if (!!root.EventSource) {
/**
* This method wraps an EventSource as an observable sequence.
* @param {String} url The url of the server-side script.
* @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event.
* @returns {Observable} An observable sequence which represents the data from a server-side event.
*/
dom.fromEventSource = function (url, openObserver) {
return new AnonymousObservable(function (observer) {
@staltz
staltz / introrx.md
Last active May 12, 2025 23:22
The introduction to Reactive Programming you've been missing