This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ControlValueAccessor } from '@angular/forms'; | |
export abstract class SimpleControlValueAccessor<T> | |
implements ControlValueAccessor | |
{ | |
value: T | null = null; | |
disabled = false; | |
onChange: (_: any) => void = (_: any) => {}; | |
onTouched: () => void = () => {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function makeComparatorFromSequence<T extends any, K = string | number>( | |
sequence: K[], | |
iteratee: keyof T | K | ((value: T) => K) | |
): (a: T, b: T) => number; | |
export function makeComparatorFromSequence<T extends string | number>( | |
sequence: T[] | |
): (a: T, b: T) => number; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
merge, | |
mergeMap, | |
Observable, | |
OperatorFunction, | |
partition, | |
toArray, | |
} from 'rxjs'; | |
import { fromArrayLike } from 'rxjs/internal/observable/from'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPLAIN ANALYZE | |
SELECT p.text, | |
pl.post_id IS NOT NULL AS liked, | |
pf.profile_id IS NOT NULL AS followed | |
FROM posts p | |
LEFT JOIN profiles a | |
ON a.id = p.author_id | |
LEFT JOIN posts_likes pl | |
ON pl.post_id = p.id | |
AND pl.profile_id = :viewer_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ecto.Query | |
defmodule Profile do | |
use Ecto.Schema | |
schema "profiles" do | |
field :username, :string | |
field :followed, :boolean, virtual: true | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.JSP; | |
import java.io.File; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.util.Scanner; | |
public class MyMatrix { | |
private int[][] mat; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Serializable; | |
public class Book implements Serializable { | |
private final int id; | |
private String title; | |
private String author; | |
private String publisher; | |
private int year; | |
private int pagesCount; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.List; | |
public class SelectionSort { | |
public static <T> void sort(List<T> a, Comparator<T> c) { | |
for (int min = 0; min < a.size() - 1; min++) { | |
int least = min; | |
for (int j = min + 1; j < a.size(); j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SnakeNamingStrategy } from 'typeorm-naming-strategies'; | |
import { NamingStrategyInterface, Table } from 'typeorm'; | |
export class OrmNamingStrategy extends SnakeNamingStrategy implements NamingStrategyInterface { | |
primaryKeyName(tableOrName: Table | string, columnNames: string[]) { | |
const table = tableOrName instanceof Table ? tableOrName.name : tableOrName; | |
return `${table}_pk`; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { QueryFailedError } from 'typeorm'; | |
export class PgError extends Error { | |
public type: PgErrorTypes; | |
public column?: string; | |
constructor(e: { type: PgErrorTypes; column?: string }) { | |
super('PostgresQL Error'); | |
this.type = e.type; |
NewerOlder