Skip to content

Instantly share code, notes, and snippets.

View LayZeeDK's full-sized avatar
🇩🇰
Denmark

Lars Gyrup Brink Nielsen LayZeeDK

🇩🇰
Denmark
View GitHub Profile
@staltz
staltz / introrx.md
Last active June 7, 2024 23:39
The introduction to Reactive Programming you've been missing
@messanjah
messanjah / structure_in_conflict
Last active January 21, 2019 14:16
Steps to commit a cleanly merged db/structure.sql file
Dealing with conflicts to db/structure.sql (when merging master)
$ git checkout master
# Change database.yml to point to database: clean (on localhost) in development env
# In one command:
# 1) drops the database specified in database.yml for current env ('clean' database)
# 2) creates a db with name specified in database.yml
# 3) loads master's structure into the database specified in database.yml
@ravibhure
ravibhure / git_rebase.md
Last active June 4, 2024 15:02
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@indiesquidge
indiesquidge / objects-over-classes.md
Last active January 17, 2024 09:30
We are better off avoiding ES6 classes in JavaScript when possible

Plain JavaScript objects are better than classes when they can be used, and many popular modern frameworks have adopted their use.

Consider that in React a component can be created as either a class or as an object.

// using a class
class Welcome extends React.Component {
  render() {
 Hello, {this.props.name}
@Xotabu4
Xotabu4 / Dokerfile
Created February 28, 2017 12:16
Simplest way to start protractor in container (as far as i know). Comments are welcome!
FROM node:7
COPY . /e2e
WORKDIR /e2e
RUN npm install
CMD npm test
@Quramy
Quramy / README.md
Last active September 4, 2020 17:24
Performance Angular unit testing

Performance of unit testing Angular app

I'm loving Angular, but running unit tests on Karma gets my nerves. It's too slow for me.

In this post, I explain mechanics under Angular's testing module and how to improve the performance.

What makes my tests slow?

To evaluate Angular unit testing performance I captured the CPU profiling with running Karma.

@Tuizi
Tuizi / test-helper.spec.ts
Last active March 19, 2021 19:47
MockStore for Angular ngrx/store unit tests
import { Action, ActionReducer, Store } from '@ngrx/store';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operator/map';
import { Observer } from 'rxjs/Observer';
// TODO: How to initialize those variables?
const dispatcherMock: Observer<Action>,
reducerMock: Observer<ActionReducer<any>>,
stateMock: Observable<any>;
import { MovieShowingsComponent } from './movie-showings.component';
import { cold, getTestScheduler } from 'jasmine-marbles';
describe('MovieShowingsComponent', () => {
it('should not have a race condition', () => {
const backend = jasmine.createSpyObj('backend', ['getShowings']);
const cmp = new MovieShowingsComponent(backend);
backend.getShowings.and.returnValue(cold('--x|', {x: ['10am']}));
cmp.selectMovie('After the Storm');
@darvell
darvell / add_node_exceptions.ps1
Created October 23, 2017 00:20
Adds useful exceptions to Windows Defender for node.js developers.
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"
Break
}
Write-Host "Excluding appdata NPM folder and Node.JS install folder from Windows Defender."
Add-MpPreference -ExclusionPath ([System.Environment]::ExpandEnvironmentVariables("%APPDATA%\npm\"))
Add-MpPreference -ExclusionPath (Get-ItemProperty "HKLM:SOFTWARE\Node.js" | Select-Object -Property InstallPath)
@tyrcho
tyrcho / howto.md
Last active November 22, 2023 02:04
Git secret and CI