Skip to content

Instantly share code, notes, and snippets.

View frederickfogerty's full-sized avatar

Frederick Fogerty frederickfogerty

View GitHub Profile
@frederickfogerty
frederickfogerty / studentCourseReviewVoteTo.js
Created April 5, 2018 08:10
Use Student Course Review API to upvote or downvote a review until it reaches the desired vote count
const vote = async ({id, direction}) => await fetch(
`http://www.studentcoursereview.co.nz/ajax/review_vote?id=${id}&direction=${direction}&_=1521348768004`
);
var voteTo = async ({ id, direction = "up", target }) => {
let currentScore = undefined;
while (true) {
const increment = currentScore == null ? 1 : Math.min(target - currentScore, 3);
const fetches = Array.from({length: increment}).map(() => vote({ id, direction }))
Info 0 Binding...
Info 1 request: {"seq":0,"type":"request","command":"configure","arguments":{"hostInfo":"vscode"}}
Info 2 Host information vscode
Info 3 response: {"seq":0,"type":"response","command":"configure","request_seq":0,"success":true}
Perf 4 0::configure: async elapsed time (in milliseconds) 0.9630
Info 5 request: {"seq":1,"type":"request","command":"compilerOptionsForInferredProjects","arguments":{"options":{"module":"CommonJS","target":"ES6","allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"allowJs":true,"jsx":"Preserve","checkJs":false}}}
Perf 6 1::compilerOptionsForInferredProjects: elapsed time (in milliseconds) 0.4295
Info 7 response: {"seq":0,"type":"response","command":"compilerOptionsForInferredProjects","request_seq":1,"success":true,"body":true}
Info 8 request: {"seq":2,"type":"request","command":"open","arguments":{"file":"/Users/fred/Programming/ts-graphql-plugin/e2e/project-fixture/main.ts","fileContent":"// it's a dummy tag func\nfunction gql
@frederickfogerty
frederickfogerty / config.js
Created October 18, 2016 10:04
Hyper Configuration
// Something
// old way
import React from 'react'
var App = React.createClass({ // ew, an object
componentWillMount: function () {}, // ew, commas needed
render: function() {
return <div />
}
})
// React 0.13 way
@frederickfogerty
frederickfogerty / server.js
Created November 17, 2015 21:52
HTML5 History API with webpack-dev-middleware
const _ = require('lodash')
const path = require('path')
const express = require('express')
const webpack = require('webpack')
const config = require('./webpack.dev.config')
const app = express()
const compiler = webpack(config)
var devMiddleware = require('webpack-dev-middleware')(compiler, {
@frederickfogerty
frederickfogerty / actions.js
Last active August 29, 2015 14:24
Wrapping action creators in dispatch explicitly
import {dispatch} from './redux'
export const myAction = (...args) => dispatch({type: CONSTANT, ...})
@frederickfogerty
frederickfogerty / bundle.js
Created June 29, 2015 09:07
Chai.js bugs with Webpack
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@frederickfogerty
frederickfogerty / karma.conf.js
Created June 4, 2015 21:40
Coverage + tests with webpack, babel, karma, mocha, and istanbul
var webpack = require('webpack')
module.exports = function (config) {
config.set({
browsers: [ 'Chrome' ], //run in Chrome
browserNoActivityTimeout: 60000,
singleRun: true, //just run once by default
frameworks: [ 'mocha' ], //use the mocha test framework
files: [
//'src/**/*.{jsx,js}',

Keybase proof

I hereby claim:

  • I am frederickfogerty on github.
  • I am frederick (https://keybase.io/frederick) on keybase.
  • I have a public key ASBmfqj8Z5f-Xxsid7UKXOGlPkeO_ecpf1fC4ndLCxeMnAo

To claim this, I am signing this object: