Skip to content

Instantly share code, notes, and snippets.

@steelywing
steelywing / checkbox.less
Created August 30, 2013 14:22
css checkbox
input[type="checkbox"].checkbox {
// basic checkbox style
display: none !important;
+ label {
cursor: pointer;
display: inline-block;
}
// lock style
@steelywing
steelywing / google-translate-tooltip.user.js
Last active October 22, 2023 16:18
google translate tooltip for firefox & chrome
// ==UserScript==
// @name Google Translate Tooltip
// @namespace steely.wing
// @version 1.10
// @description Translates selected text into a tooltip.
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @copyright 2014, Wing Leong (http://steelywing.iblogger.org/)
// @include *
// @require http://code.jquery.com/jquery-2.1.0.min.js
// @grant GM_getValue
@steelywing
steelywing / jquery.draggable.js
Last active August 29, 2015 13:57
jQuery draggable plugin
// jQuery draggable plugin
(function($) {
$.fn.draggable = function(options) {
var $handle = this,
$draggable = this;
options = $.extend({}, {
handle: null,
// allow children to be a handle
handleChildren: true,
@steelywing
steelywing / jquery.plugin.js
Last active March 11, 2020 19:57
jQuery plugin boilerplate
/*
* Project:
* Description:
* Author:
* License:
*/
// the semi-colon before function invocation is a safety net against concatenated
// scripts and/or other plugins which may not be closed properly.
;(function ($, window, document, undefined) {
@steelywing
steelywing / mro.py
Created March 19, 2014 07:18
python multiple inheritance
class Base(object):
def __init__(self, c):
print('Base called by {0}'.format(c))
super().__init__()
class ParentA(Base):
def __init__(self, c):
print('ParentA called by {0}'.format(c))
#Base.__init__(self, 'ParentA')
super().__init__('ParentA')
from flask import Flask
from werkzeug.routing import BaseConverter
app = Flask(__name__)
class RegExConverter(BaseConverter):
def __init__(self, map, regex='[^/]+'):
super().__init__(map)
self.regex = regex
-- This will replace the other fields to default value
INSERT OR REPLACE INTO book(id, name) VALUES(1001, 'Programming');
-- INSERT OR UPDATE (Method 1)
INSERT OR IGNORE INTO book(id) VALUES(1001);
UPDATE book SET name = 'Programming';
-- INSERT OR UPDATE (Method 2)
INSERT OR REPLACE INTO book (id, name)
VALUES (1001, 'Programming',
@steelywing
steelywing / format_number.js
Last active October 28, 2020 04:50
JavaScript format number
/**
* Format number
*
* (1234567.8).format(2)
* => "1,234,567.80"
*
* precision: decimal precision
*/
// Method 0 (http://stackoverflow.com/a/14428340/1877620)
@steelywing
steelywing / JavaScript Class.md
Last active August 29, 2015 14:01
javascript class explain
function Class() {}

actually

Class.prototype = new Object();
Class.prototype.constructor = Class;
@steelywing
steelywing / WinImage-KeyGen.html
Last active March 10, 2024 12:14
winimage 9.0 keygen
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>WinImage 9.0 KeyGen</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="text-align: center;">
<h1>WinImage 9.0 KeyGen</h1>