Skip to content

Instantly share code, notes, and snippets.

View JCGrant's full-sized avatar
🤓

James Grant JCGrant

🤓
View GitHub Profile
{
"suggest.noselect": false,
"coc.preferences.formatOnSaveFiletypes": [
"javascript",
"typescript",
"typescriptreact",
"json",
"javascriptreact",
"typescript.tsx",
"graphql"
@JCGrant
JCGrant / init.vim
Created December 1, 2019 01:25 — forked from benawad/init.vim
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
@JCGrant
JCGrant / README.md
Created November 25, 2018 20:59
Code from "Typing the technical interview" by Kyle "Aphyr" Kingsbury - https://aphyr.com/posts/342-typing-the-technical-interview

Typing the technical interview

Originally written by Kyle "Aphyr" Kingsbury

Definitely check out the awesome blog post where this code originated. It's well worth the read!

To run:

$ ghci Solution.hs

*Main> :type solution (nil :: N6)

@JCGrant
JCGrant / timer.py
Created May 30, 2017 19:46
Running a timer object in a separate thread in Python
from threading import Thread
import time
class Timer():
def __init__(self):
self.time = 0
def run(self):
while True:
self.time += 1
@JCGrant
JCGrant / sunflower.pde
Created May 30, 2017 18:37
Drawing sunflowers with Processing
color petalColor = #FFC608;
color seedsColor = #2A1B12;
color stemColor = #6C7D36;
color backgroundColor = #89B4EA;
void setup() {
size(1920, 1080);
frameRate(5);
background(backgroundColor);
}
using System;
using System.IO;
using System.Collections.Generic;
namespace SemanticEvolution {
public class Program {
private static List<double> GetValuesFromCsv(string filePath, char delimiter=',') {
List<double> values = new List<double>();
@JCGrant
JCGrant / Improving the Halite Random Bot (Python 3)
Last active November 12, 2016 04:17 — forked from benjaminfspector/Improving the Halite Random Bot (Python 3)
Halite Random Improvement Sample Code (Python 3)
This Gist contains the sample code for improving the sample Halite random bot in Python 3.
@JCGrant
JCGrant / filter-proposals-by-allocation.js
Created November 11, 2016 20:41
A quick script to filter out any projects that have been fully allocated at https://project-portal.doc.ic.ac.uk/proposal_selection
const available = (tr) => {
let tds = tr.getElementsByTagName('td');
let title_td = tds[2];
let title_text = title_td.textContent;
let num_allocated_str = title_text[title_text.length - 2];
let num_allocated = parseInt(num_allocated_str);
let num_places_available_td = tds[5];
let num_places_available_str = num_places_available_td.textContent;
let num_places_available = parseInt(num_places_available_str);
@JCGrant
JCGrant / hide-youtube-comments.user.js
Created September 5, 2016 15:32
A User Script which hides the comments section on Youtube
// ==UserScript==
// @name Hide Youtube Comments
// @namespace https://gist.github.com/JCGrant/8b7c64c4ae38c28b26c01f55dea39468
// @version 0.1
// @description Hide Youtube Comments
// @author JCGrant
// @match https://www.youtube.com/watch*
// @grant none
// ==/UserScript==
/*
* Copy and paste the following code after clicking
* NEW GAME at http://guessthecorrelation.com.
* Tested and works in Chrome. Not sure about other
* browsers due to usage of ES6 features.
*/
const parseTransformStringIntoPoint = (transformString) => {
let splitString = transformString.split(',');
let xString = splitString[0].substring(10, splitString[0].length);