Skip to content

Instantly share code, notes, and snippets.

View mattbis's full-sized avatar

Matthew mattbis

View GitHub Profile
@fulminmaxi
fulminmaxi / example.js
Created May 9, 2020 20:17
Async Constructor Helper in JavaScript
function WillBe(Class){
return class AsyncConstructor extends Class {
constructor(...values) {
super(...values);
this.willBe = (async () => {
let resolvedThis = await promiseAllObj(this);
//Remove this.willBe to avoid circular promises
return Object.keys(resolvedThis)
.reduce((acc,key) => (key === 'willBe'
? acc
#include <cs50.h>
#include <stdio.h>
#include <math.h>
int main(void)
{
//create a variable to hold value of coins
int coins = 0;
//get change amount
float change = get_float("Change owed: ");
@spuds51
spuds51 / README.md
Created May 9, 2020 18:10 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@cypher-nullbyte
cypher-nullbyte / Question(point_to_point).txt
Last active May 16, 2020 08:35
Vpropel VIT | POD | 08/05/2020 | Point to Point | Similar to Frog Jump 404 LeetCode
Point to Point
Shyam is standing in Point A. He has to reach Point B. There are m number of divisions
between Point A and point B.
These division may or may not have a stone. One can jump only on the stone.
Given a list of stones positions (in division) in sorted ascending order,
determine whether Shyam can reach Point B.
class ValidPerfectSquare {
public boolean isPerfectSquare(int num) {
if (num < 2) {
return true;
}
long left = 1l;
long right = num;
long mid, product;
while (left <= right) {
mid = left + (right - left) / 2;
@TheGloriousGenesis
TheGloriousGenesis / EvaluatingPostFix.java
Created May 9, 2020 17:32
Evaluating post fix expression
public static String operators = "+-^*/";
public static void main(String[] args){
System.out.println(evaluatePostFix("6 2 3 + - 3 8 2 / + * 2 ^ 3 +"));
}
private static int evaluatePostFix(final String infix) {
Stack<Integer> numberStack = new Stack<>();
String[] infixCharacters = infix.split("");
for (String i: infixCharacters) {
@heffcodex
heffcodex / Makefile
Created May 9, 2020 17:31
Multi-arch generic makefile for go
DIR = ./.build
EXECUTABLE = app
GOARCH = amd64
GOOSWIN = windows
GOOSX = darwin
GOOSLINUX = linux
GOMOD = on
CGO_ENABLED = 0
@bladebhs
bladebhs / first.erl
Last active May 11, 2020 16:28
My first Erlang program. Functional Programming in Erlang course
-module(first).
-export([double/1, mult/2, area/3, square/1, treble/1]).
mult(X, Y) ->
X * Y.
double(X) ->
mult(2, X).
area(A, B, C) ->
@fabriziobagala
fabriziobagala / BinaryGap.cs
Created May 9, 2020 17:27
Find longest sequence of zeros in binary representation of an integer.
using System;
class Solution
{
public int solution(int N)
{
const int mask = 1;
var binaryGap = 0;
int? currentBinaryGap = null;
@prakharshibu
prakharshibu / Simple array sum
Created May 9, 2020 17:23
Simple array sum
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,sum=0;
cin>>n;
int a[n];
for(int i=0;i<n;i++)