Skip to content

Instantly share code, notes, and snippets.

@j03m
j03m / courses2.cpp
Created February 27, 2021 13:26
topological sort for class prereqs
#include<unordered_set>
#include<vector>
#include<unordered_map>
#include<iostream>
using namespace std;
class Solution {
public:
vector<int> findOrder(int numCourses, vector<vector<int>>& prerequisites) {
@j03m
j03m / find-cycle-recursive.cpp
Created February 20, 2021 15:01
DFS find cycle
#include<vector>
#include<unordered_map>
#include<stack>
#include<iostream>
using namespace std;
bool findCycle(int head, unordered_map<int, vector<int>> &graph, vector<bool> &black, vector<bool> &gray){
if (black[head]){
return false;
@j03m
j03m / plt.py
Created October 16, 2020 10:49
plt matplotlib multiple y values single x axis with figure size
plt.figure(figsize=(50,50))
ax = plt.plot(df1['close'], color='b', label='close')
ax2 = plt.gca().twinx()
plt.plot(df1['HT_TRENDMODE'], color='r', label='close')
plt.legend()
@j03m
j03m / approach1.js
Last active October 23, 2017 20:52
async init
function Model(stuff) {
this.d_stuffInterface = stuff;
}
Model.prototype.init = function (){
return this.d_stuffInterface.getData().then(function(data){
this.d_data = data;
return data;
}.bind(this);
}

   _-\0/-_
  |\     /| 
  | \   / |
 { } \_/ { }  
     / \
    /   \
   -     -
@j03m
j03m / gist:a6a7bda547f4cdc0cdd4
Created November 6, 2015 13:43
react native process batch message
{
"arguments":[
[
{
"module":"BatchedBridge",
"method":"invokeCallbackAndReturnFlushedQueue",
"args":[
3,
[
null,
[
[
11,
25,
25,
25,
25,
25,
25,
25,
@j03m
j03m / gist:309e49bb9fa13e628609
Last active August 29, 2015 14:25 — forked from steida/gist:8592161
Gulp.js, keep the original folder structure, for side by side compilation.
var coffee = require('gulp-coffee');
var eventStream = require('event-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var scriptsDirs = [
'bower_components/este-library/este/',
'client/',
'server/'
];
@j03m
j03m / default constructor syntax
Created June 26, 2015 14:13
i have so many reasons to hate c++
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
class Rectangle {
int width, height;
public:
Rectangle (int,int);
@j03m
j03m / .jscs.json
Last active August 29, 2015 14:20 — forked from anissen/.jscs.json
{
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
"requireLeftStickedOperators": [","],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,