Skip to content

Instantly share code, notes, and snippets.

View wspl's full-sized avatar
⛱️
every cloud has a silver lining

PLUTO wspl

⛱️
every cloud has a silver lining
View GitHub Profile
@wspl
wspl / Tronx.main.ts
Last active June 13, 2018 05:28
Tronx - Mobx for Electron
export type TronxHandler = () => void
interface TronxStore {
value: any,
handlers: Set<TronxHandler>
}
class TronxTable {
propertyMap = new Map<object, Map<PropertyKey, TronxStore>>()
refMap = new Map<object, TronxStore>()
@wspl
wspl / NamedComponents.ts
Created June 13, 2018 05:24
Easy naming react components for styling
import { DetailedHTMLProps, HTMLAttributes, InputHTMLAttributes } from 'react'
import * as React from 'react'
import classNames from 'classnames'
export type NamedComponentsProps<A extends HTMLAttributes<E>, E extends Element> = DetailedHTMLProps<A, E> & {
innerRef?: (ref: E) => void
flags?: { [key: string]: boolean }
}
export type NamedComponentsMap<A extends HTMLAttributes<E>, E extends Element> = {
@wspl
wspl / PLIcon.tsx
Created June 13, 2018 05:23
PLIcon - React svg icon component helper
import * as React from 'react'
import { MouseEvent, CSSProperties } from 'react'
import styled from 'styled-components'
export interface IPLIconProps {
size?: number
color?: string
hoverColor?: string
opacity?: number
style?: CSSProperties
@wspl
wspl / Synx.ts
Created June 13, 2018 05:19
Synx - Electron application global state synchronization library (with mobx).
import { ipcMain, ipcRenderer, WebContents } from 'electron'
import { autorun, toJS } from 'mobx'
import { PLStore } from './PLStore'
enum SynxActionType {
Subscribe,
Update
}
interface ISynxAction {
@wspl
wspl / PLStore.ts
Created June 13, 2018 05:18
PLStore for Electron Application
import { app } from 'electron'
import path from 'path'
import fs from 'fs'
import { promisify } from 'util'
interface TargetKeyPair {
target: any,
key: PropertyKey
}
@wspl
wspl / deleter.js
Created August 26, 2017 22:40
Qzone Deleter
jqTag = document.createElement('script')
jqTag.setAttribute("type","text/JavaScript")
jqTag.setAttribute("src", 'https://cdn.bootcss.com/jquery/3.2.1/jquery.js')
document.getElementsByTagName("head")[0].appendChild(jqTag)
fuckers = $('body').find('iframe').eq(0).contents().find('.del')
deleter = (index) => {
fuckers[index].click()
setTimeout(() => {
$('.qz_dialog_layer_btn.qz_dialog_layer_sub')[0].click()
v += tableView => { v in
v~.backgroundColor = .clear
v.top = v.prev.top - 5
v.bottom = v.parent.bottom
v.edgesX = v.parent.edgesX
v += self.refresher => { v in
v~.tintColor = .white
v~.addTarget(self, action: #selector(self.refresh), for: .valueChanged)
@wspl
wspl / highres_windows.go
Created January 11, 2017 09:45
(Go) High Resolution Timer / Sleeper for Windows
package main
import (
"syscall"
"unsafe"
"time"
)
var (
kernel32Dll = syscall.NewLazyDLL("kernel32.dll")