Skip to content

Instantly share code, notes, and snippets.

View ZhangYiJiang's full-sized avatar
🎼
Practising his hemidemisemiquaver

Zhang Yi Jiang ZhangYiJiang

🎼
Practising his hemidemisemiquaver
View GitHub Profile
echo file_get_contents('this_is_the_flag.php');
@ZhangYiJiang
ZhangYiJiang / extract.js
Last active December 25, 2017 07:47
v2 -> v3 data migration test scripts
// 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;
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 / innovations.json
Created August 21, 2018 06:22
Netexplo Innovations
[
{
"title": "Hyphen",
"description": "A call centre run by chatbots"
},
{
"title": "Aquapioneers Ecosystem",
"description": "Grow your zero-km food with aquaponics"
},
{
@ZhangYiJiang
ZhangYiJiang / index.js
Created January 20, 2019 14:26
NUSMods GitHub Venues Hook
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) =>
@ZhangYiJiang
ZhangYiJiang / getAllPoI.js
Created January 31, 2019 14:13
Get all places of interest in NUS
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 / copy-data.js
Created March 15, 2019 09:52
For testing NUSMods data migration
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)