Skip to content

Instantly share code, notes, and snippets.

View injust90's full-sized avatar
🎯
Focusing

Justin Chou injust90

🎯
Focusing
View GitHub Profile
class Stack {
constructor () {
this.storage = {}
this.size = 0
}
push(element) {
this.size++
this.storage[this.size] = element
@injust90
injust90 / arrowandclass.js
Created April 7, 2020 17:42
Arrow function expressions and classes
function Fruit (type) {
this.type = type;
this.color = 'unknown';
this.getInformation = function() {
return 'This ' + this.type + ' is ' + this.color + '.';
}
}
function Fruit2(type) {
this.type = type;
@injust90
injust90 / PrintFullPath.cpp
Created September 23, 2022 23:23
Used to print the working directory
void PrintFullPath(const char* partialPath)
{
char full[_MAX_PATH];
if (_fullpath (full, partialPath, _MAX_PATH) != NULL)
printf("Full path is %s\n", full);
else
printf("Invalid path\n" );
}
int main()
int lonelyinteger(vector<int> a) {
int result = 0;
// for each element if result is equal to start of line then result is set to that value.
for (int i : a)
{
result = result ^ i;
}
return result;
#include "CircleComponent.h"
#include "Actor.h"
CircleComponent::CircleComponent(class Actor* owner)
:Component(owner)
, mRadius(0.0f)
{
}
#include <stdio.h>
#include <string>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
const int SCREEN_WIDTH = 1280;
const int SCREEN_HEIGHT = 960;
@injust90
injust90 / Makefile
Created November 28, 2022 22:10
Makefile template
# OBJS declares the files to be compiled
OBJS = Main.cpp Game.cpp
# CC declares the compiler (GCC)
CC = g++
# COMPILER_FLAGS declares the additional compilation options
# -w suppresses warnings
COMPILER_FLAGS = -w
@injust90
injust90 / Game.h
Last active December 1, 2022 05:11
#include <SDL2/SDL.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
@injust90
injust90 / smoke.cfg
Created December 22, 2022 22:18
smoke practice for cs:go
sv_cheats 1;
bot_kick;
mp_warmup_end;
mp_freezetime 0;
mp_roundtime_defuse 60;
sv_grenade_trajectory 1;
sv_grenade_trajectory_time 10;
sv_showimpacts 1;
ammo_grenade_limit_total 5;
sv_infinite_ammo 1;
@injust90
injust90 / diagonal_algorithm.cpp
Last active December 26, 2022 21:42
Cross counting X pattern in a vector
#include <iostream>
#include <vector>
using namespace std;
// Defining rows and columns of
// vector of vectors
int main()
{
int diagonalRight = 0;