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
(function() { | |
angular.module("MeApp", []) | |
.provider("weather", function() { | |
var PROVIDER_TYPE = null, | |
valid_providers = [100,101,102,103], | |
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 { createStore , combineReducers } from "redux"; | |
//actions | |
const sayNamaste = (target) => ({type: 'SAY_NAMASTE', target}); | |
const spyOn = (target) => ({type: 'SPY_ON', target}); | |
//Reducers |
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 React, {Component} from "react"; | |
import ReactDOM from "react-dom"; | |
import { createStore } from "redux"; | |
import { Provider, connect } from "react-redux"; | |
function todoApp(state = {}, action) { | |
switch(action.type) { | |
case 'ADD_ME': | |
let todos_added = [...state.todos]; |
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 React, {Component} from "react"; | |
import ReactDOM from "react-dom"; | |
import { createStore, applyMiddleware, compose } from "redux"; | |
import { Provider, connect } from "react-redux"; | |
import fetch from "node-fetch"; | |
import thunk from "redux-thunk"; | |
const OWA_API_KEY = `[YOUR API KEY GOES HERE]`; |
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 React, { Component } from "react"; | |
import ReactViewer from "react-viewer"; | |
import 'react-viewer/dist/index.css'; | |
import ReactCrop from 'react-image-crop'; | |
import 'react-image-crop/dist/ReactCrop.css'; | |
class App extends Component { | |
constructor() { | |
super(); |
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
(function() { | |
//Extend Javascript's Soul Here | |
Array.prototype.countNumbers = function() { | |
return this.filter(num => { | |
return Number(num)/Number(num) === 1; | |
}).length; | |
}; | |
})(); |
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
const quicksort = (arr) => { | |
if(arr.length < 2) return arr; | |
const pivotIndex = Math.floor(arr.length / 2); | |
const pivot = arr[pivotIndex]; | |
let less = []; | |
let more = []; | |
for(let i=0; i < arr.length; i++) { | |
if(i!=pivotIndex) arr[i] >= pivot ? more.push(arr[i]) : less.push(arr[i]); | |
} | |
return [ |
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
const G = [ | |
[Infinity, 3,Infinity], | |
[3, Infinity, 6], | |
[Infinity, 6, Infinity], | |
]; | |
const dijkstras = (G, start) => { | |
let N = G.length; | |
let visited = new Array(N).fill(false, 0, N); | |
let route = new Array(N).fill(start, 0, N); |
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
gzip on; | |
gzip_comp_level 6; | |
gzip_buffers 16 8k; | |
gzip_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component application/x-javascript text/xml application/octet-stream; | |
gzip_proxied expired no-cache no-store private auth; | |
client_max_body_size 0; | |
underscores_in_headers on; | |
limit_req_zone $binary_remote_addr zone=uploadlimit:10m rate=3r/s; |
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
/** | |
* Subset Pairs - fp style | |
* P = numbers, S = sumRequired | |
* subSetPairs - returns all possible unique pairs | |
*/ | |
const subSetPairs = (numbers, sumRequired) => { | |
return numbers.map((num, idx) => [ | |
numbers[idx], | |
...numbers.slice(0, idx), | |
...numbers.slice(idx + 1, numbers.length) |
OlderNewer