Skip to content

Instantly share code, notes, and snippets.

🎼
Practising his hemidemisemiquaver

Zhang Yi Jiang ZhangYiJiang

🎼
Practising his hemidemisemiquaver
Block or report user

Report or block ZhangYiJiang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ZhangYiJiang
ZhangYiJiang / copy-data.js
Created Mar 15, 2019
For testing NUSMods data migration
View copy-data.js
code = '';
Object.keys(localStorage).forEach(k => {
if (k === 'reduxState') return;
code += `localStorage[${JSON.stringify(k)}] = ${JSON.stringify(localStorage[k])};\n`;
});
code += 'window.location.reload()'
copy(code)
@ZhangYiJiang
ZhangYiJiang / getAllPoI.js
Created Jan 31, 2019
Get all places of interest in NUS
View getAllPoI.js
import axios from 'axios'
import * as fs from 'fs-extra'
import * as _ from 'lodash'
const POI_NETWORK_URL = 'https://arcgis.ami-lab.org/arcgis/rest/services/FULL_NUS_NETWORK_051017/FULL_NUS_NETWORK_150118/MapServer/8/query'
async function getPoi() {
let lastId = 0;
let features;
const allPlaces = [];
@ZhangYiJiang
ZhangYiJiang / index.js
Created Jan 20, 2019
NUSMods GitHub Venues Hook
View index.js
const git = require('isomorphic-git');
const axios = require('axios');
const Octokit = require('@octokit/rest');
const octokit = new Octokit();
const codeBlock = (text, lang = '') =>
'```' + lang + '\n' + text + '\n```';
const unorderedList = (items) =>
View innovations.json
[
{
"title": "Hyphen",
"description": "A call centre run by chatbots"
},
{
"title": "Aquapioneers Ecosystem",
"description": "Grow your zero-km food with aquaponics"
},
{
View test-react-persist.js
var c = `
localStorage.clear();
localStorage.setItem('reduxState', JSON.stringify(${localStorage.getItem('reduxState')}));
window.location.reload();`;
if (typeof copy === 'function') {
console.info('Go to https://deploy-preview-669--nusmods.netlify.com/ and paste the code that has been copied into the console');
copy(c);
} else {
console.info('Go to https://deploy-preview-669--nusmods.netlify.com/ and paste this into the console');
@ZhangYiJiang
ZhangYiJiang / extract.js
Last active Dec 25, 2017
v2 -> v3 data migration test scripts
View extract.js
// NUSMods v2 timetable data extractor
var loaderTemplate = data => `
var s = document.createElement('script');
s.src = 'https://cdnjs.cloudflare.com/ajax/libs/localforage/1.5.5/localforage.min.js';
s.onload = function() {
const data = ${data};
let count = 0;
View get-key.php
echo file_get_contents('this_is_the_flag.php');
View ivle-quiz-taker.user.js
// ==UserScript==
// @name IVLE LMS Quiz taker
// @namespace yijiang
// @version 0.1
// @description Completes IVLE LMS modules by randomly clicking on buttons
// @author Zhang Yijiang
// @match https://ivle.nus.edu.sg/Databank/LMS/*
// ==/UserScript==
(function(window){
@ZhangYiJiang
ZhangYiJiang / Event.swift
Last active Feb 7, 2017
Typed events for Swift 3
View Event.swift
//
// Event.swift
//
/**
Typed event implementation from <http://blog.scottlogic.com/2015/02/05/swift-events.html>
Updated and improved for Swift 3
## Usage
@ZhangYiJiang
ZhangYiJiang / ivle-scraper.user.js
Created Sep 27, 2016
Scrapes IVLE for module CourseIDs
View ivle-scraper.user.js
// ==UserScript==
// @name Scrapes IVLE Course ID
// @namespace yijiang
// @version 1
// @match https://ivle.nus.edu.sg/v1/lms/list_course.aspx?src=bm&code=&title=&lecName=&acadyear=2016%2f2017&semester=Semester+1&ModTitleExact=N&LecNameExact=N
// @grant none
// ==/UserScript==
function switchPage(page){
$('#GV_Page2').val(page).change();
You can’t perform that action at this time.