Skip to content

Instantly share code, notes, and snippets.

Sean Wragg sean3z

Block or report user

Report or block sean3z

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
@sean3z
sean3z / index.js
Last active Apr 4, 2019
Get around Quizlet paywall
View index.js
let terms = document.querySelectorAll('.SetPageTerm.has-definitionText, .SetPageTerms-termsList');
for (let term of terms) term.classList.add('is-showing');
document.querySelector('.SignupWallInline').style.display = 'none';
@sean3z
sean3z / index.js
Last active Apr 9, 2019
Get around CourseHero preview limit
View index.js
let content = document.querySelector('main.bdp_docViewerWide_main');
$('.bdp_doc-viewer_notification').after(content.innerHTML);
$('.mfp-bg.mfp-ready, .mfp-content').hide();
document.querySelector('body').style.overflow = 'auto';
@sean3z
sean3z / server.js
Last active May 30, 2018
Restify JWT Sign example
View server.js
const config = require('./config');
const rjwt = require('restify-jwt-community');
const jwt = require('jsonwebtoken');
// using restify-jwt to lock down everything except /auth
app.use(rjwt(config.jwt).unless({
path: ['/auth']
}));
// using the `req.user` object provided by restify-jwt
@sean3z
sean3z / server.js
Created May 29, 2018
Restify JWT example
View server.js
const user = require('./lib/user');
app.post('/auth', (req, res, next) => {
let {username, password} = req.body;
user.authenticate(username, password).then(data => {
res.send(data);
})
});
@sean3z
sean3z / user.js
Last active May 30, 2018
Restify JWT example
View user.js
"use strict";
exports.authenticate = (username, password) => {
return Promise.resolve({ uid: 1, name: 'Sean', admin: false });
};
/*
exports.authenticate = (username, password) => {
return new Promise((resolve, reject) => {
db.findOne({username, password}, (err, data) => {
@sean3z
sean3z / config.json
Created May 29, 2018
Restify JWT example
View config.json
{
"jwt": {
"secret": "&@$!changeme!$@&"
}
}
@sean3z
sean3z / server.js
Last active May 30, 2018
Restify JWT example skeleton
View server.js
"use strict";
const restify = require('restify');
const config = require('./config');
const app = restify.createServer();
app.use(restify.plugins.queryParser());
app.use(restify.plugins.bodyParser());
app.listen(8080, () => {
@sean3z
sean3z / cpu.rs
Last active May 1, 2018
Example CPU module
View cpu.rs
pub struct Cpu {
pub program: u16, // program counter
stack: [u16; 16], // stack storage
pointer: u8, // stack pointer
delay: u8 // delay timer
}
impl Cpu {
pub fn new() -> Cpu {
Cpu {
@sean3z
sean3z / main.rs
Last active May 15, 2018
Example main
View main.rs
mod cpu;
mod keypad;
mod display;
mod system;
use system::System;
fn main() {
let mut system = System::new();
@sean3z
sean3z / system.rs
Last active May 15, 2018
Example System
View system.rs
use cpu::Cpu;
use display::Display;
use keypad::Keypad;
pub struct System {
cpu: Cpu,
memory: [u8; 4096],
keypad: Keypad,
display: Display
}
You can’t perform that action at this time.