Skip to content

Instantly share code, notes, and snippets.

View alexkirsz's full-sized avatar

Alex Kirszenberg alexkirsz

View GitHub Profile
@alexkirsz
alexkirsz / tamper.js
Created February 9, 2018 18:18
Tamper with Facebook's draft editor
// ==UserScript==
// @name Facebook Tamper
// @version 0.1
// @author Alexandre Kirszenberg
// @match https://www.facebook.com/*
// @grant none
// ==/UserScript==
(function() {
function compose(React, ContentState, EditorState, DraftEditor) {
@alexkirsz
alexkirsz / user-script.js
Created October 2, 2016 12:16
Decent OfficeMix player
// ==UserScript==
// @name Decent OfficeMix player
// @version 1.0
// @description Remove paused logo and add keyboard controls to the OfficeMix player
// @author Alexandre Kirszenberg <[email protected]>
// @run-at document-start
// @match https://mix.office.com/embed/*
// @grant none
// ==/UserScript==
@alexkirsz
alexkirsz / facebook-flowers.js
Created June 2, 2016 00:48
Always add flowers to Facebook Messenger
import React, { Component } from 'react';
function compose(ChatMessage, ImmutableObject) {
return class ComposedChatMessage extends Component {
render() {
const message = new ImmutableObject(this.props.message, {
customizations: [
{
customization_type: 'border',
customization_value: 'flowers',
@alexkirsz
alexkirsz / sixth-sense.js
Created May 23, 2016 18:56
Core hook of the Facebook Sixth Sense Chrome extension
function getUserId(fbid) {
return fbid.split(':')[1];
}
requireLazy(
['MercuryTypingReceiver', 'MercuryThreads', 'ShortProfiles'],
(MercuryTypingReceiver, MercuryThreads, ShortProfiles) => {
MercuryTypingReceiver
.get()
@alexkirsz
alexkirsz / script.js
Last active August 9, 2020 10:31
YouTube Player for edX
// ==UserScript==
// @name YouTube Player for edX
// @namespace morhaus
// @version 1.1
// @description Replace the default edX video player with the YouTube player
// @author Alexandre Kirszenberg <alexandre.kirszenberg@gmailcomr>
// @match https://courses.edx.org/*
// @match https://courses.ionisx.com/*
// @grant none
// ==/UserScript==
@alexkirsz
alexkirsz / OCaml-REPL-windows.sublime-build
Created October 4, 2015 11:27
ST3 Build Systems for OCaml
{
"shell_cmd": "type $file | ocaml",
"selector": "source.ml"
}
@alexkirsz
alexkirsz / gist:ec9f5d4479efc115e533
Last active August 29, 2015 14:20
Children propType validation
let propTypes = {
children(props, propName) {
let errors = [];
React.Children.map(props[propName], child => {
if (child.type !== Foo) {
errors.push(`${child.key} is not a Foo element`);
}
});
if (errors.length > 0) {
return new Error(errors.join(', '));
@alexkirsz
alexkirsz / gist:78fe94eb84451a55ba9e
Last active August 29, 2015 14:20
Date to/from date and time inputs
let [date, time] = dateObj.toISOString().split('T');
time = time.split('.')[0].split(':').slice(0, 2).join(':');
let dateObj = new Date(`${date}T${time}.000Z`);
@alexkirsz
alexkirsz / ForceCaseSensitivityPlugin.js
Last active February 23, 2017 13:38
Force case sensitivity in webpack
/*
The MIT License (MIT)
Copyright (c) 2015 Alexandre Kirszenberg
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTI
function TorrentStore() {
EventEmitter.call(this);
}
TorrentStore.prototype = Object.assign({}, EventEmitter.prototype, { ... });