Skip to content

Instantly share code, notes, and snippets.

Oscar Reyes oscarryz

Block or report user

Report or block oscarryz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@oscarryz
oscarryz / Testing express controllers.md
Last active Feb 13, 2020
Testing with supertest and mockery
View Testing express controllers.md

TL;DR

  • Use mockery to inject a mock the require dependency
  • Use supertest to make an http request to the server
  • Use mocha as test runner

How to test express controllers

Setup

Source code for this example

View about stackoverflow growth .md

I think StackOverflow was awesome when it started (and several years later still is) but over then it had failed to innovate / grow.

There has been attempts to create products like SO documentation, and SO jobs (and now SO teams) but they are not aligned with what made SO good in the first place. ¿What is the one thing SO was meat to solve in the first place?

This is was Jeff Atwood wrote when it was launched:

https://blog.codinghorror.com/stack-overflow-none-of-us-is-as-dumb-as-all-of-us/

Stackoverflow is sort of like the anti-experts-exchange (minus the nausea-inducing sleaze and quasi-legal search engine gaming) meets wikipedia meets programming reddit. It is by programmers, for programmers, with the ultimate intent of collectively increasing the sum total of good programming knowledge in the world. No matter what programming language you use, or what operating system you call home. Better programming is our goal.

View Element.js
ElementHandle {
_context:
ExecutionContext {
_client:
CDPSession {
_events: [Object],
_eventsCount: 27,
_maxListeners: undefined,
_callbacks: Map {},
_connection: [Connection],
View A.java
abstract class A {
public String s() {
return this.getClass().getName();
}
}
class B extends A {
public static void main(String...args) {
System.out.println(B.class.getName());
System.out.println(new B().s());
}
View Open JDK.md
View hash.json
{
"hash": "87b6c030d59c1c74357bb19a89d206517e09df2d"
}
View NotInherited.java
//A.java
class A {
private int i;
public String toString() { return ""+ i; }
}
// B.java
class B extends A {}
// Main.java
class Main {
public static void main( String [] args ) {
View MethodReference.java
import java.util.function.BiConsumer;
import java.util.Arrays;
import java.util.List;
class SimpleClass {
void methodA(String a, String b) {
System.out.printf("%s %s%n", a, b);
}
}
View Mano.java
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Mano {
You can’t perform that action at this time.