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');
// ==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 / AddUser.php
Created May 5, 2016 12:16
Add user command for Laravel
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\User;
class AddUser extends Command
{
/**
@ZhangYiJiang
ZhangYiJiang / Event.swift
Last active February 7, 2017 04:17
Typed events for Swift 3
//
// 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 September 27, 2016 15:38
Scrapes IVLE for module CourseIDs
// ==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();
@ZhangYiJiang
ZhangYiJiang / majority.py
Created September 9, 2016 05:48
Finding Majority
from pprint import pprint
def find_majority(lst):
maj = majority(lst)
pprint(maj)
if len(maj) > 1:
return 'Not Found'
else:
return list(maj.keys())[0]
@ZhangYiJiang
ZhangYiJiang / cors.user.js
Created August 12, 2016 04:26
Reorder CORS tutorial ranking using drag and drop
// ==UserScript==
// @name CORS Tutorial Reordering
// @namespace yijiang
// @description Reorder CORS tutorial ranking using drag and drop
// @include https://myaces.nus.edu.sg/cors/RankTutorialServlet
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
// @version 1
// @grant none
// ==/UserScript==
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document
domain("gaming.stackexchange.com"),
domain("meta.gaming.stackexchange.com") {
/* Tag hover fix */
a.post-tag::before, span.post-tag::before {
transition: all .15s;
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
class DenyFrames
{
public function handle(Request $request, \Closure $next)
{
return $next($request)->header('X-Frame-Options', 'DENY');
@ZhangYiJiang
ZhangYiJiang / 0_reuse_code.js
Created May 5, 2016 12:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console