Skip to content

Instantly share code, notes, and snippets.

View ssskip's full-sized avatar
💭
I may be slow to respond.

ssskip

💭
I may be slow to respond.
View GitHub Profile
@ssskip
ssskip / $.fn.placeholder
Created March 19, 2014 08:15
jQuery placeholder
(function($) {
var t = function() {
};
"placeholder" in document.createElement("input") || (t = function() {
var t = $(this), n = t.attr("placeholder");
n && (t.focus(function() {
this.value === n && (this.value = ""), t.removeClass("placeholder");
}).blur(function() {
this.value === "" && (this.value = n, t.addClass("placeholder"));
}), t.val() === "" && t.addClass("placeholder"), t.val() || t.val(n));
@ssskip
ssskip / webnotification.js
Created April 26, 2014 14:04
implement html5 web notification support chrome Safari
;(function (window) {
"use strict";
void function () {
var notify= null, i = -1, EVENT_TYPE = {show: 1, error: 1, close: 1, click: 1}, DesktopNotify = {isSupport: function () {
return "Notification" in window || "webkitNotifications" in window
}, show: function (e, i, n) {
notify = this.create(e, i, n), notify.show()
}, showHTML: function (e) {
notify = this.createHTML(e), notify.show()
}, hide: function (callback) {
@ssskip
ssskip / notify.js
Created April 28, 2014 06:18
notify.js
;
(function (window) {
"use strict";
void function () {
var notify= null, perm = -1, EVENT_TYPE = {show: 1, error: 1, close: 1, click: 1}, DesktopNotify = {isSupport: function () {
return "Notification" in window || "webkitNotifications" in window
}, show: function (e, i, n) {
notify = this.create(e, i, n), notify.show()
}, showHTML: function (e) {
notify = this.createHTML(e), notify.show()
(function (exports) {
'use strict';
var _module = exports.angular.module;
exports.angular.module = function () {
var module = _module.apply(this, arguments);
module.decorate = function (dest, fn) {
module.config(function ($provide) {
$provide.decorator(dest, fn);
});
return module;

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@ssskip
ssskip / ISO3166-1.alpha2.json
Last active May 21, 2024 13:46
json of country codes (ISO 3166-1 alpha-2) and corresponding names
{
"AF": "Afghanistan",
"AX": "Aland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
@ssskip
ssskip / query_table_size_in_db
Created February 2, 2015 06:29
query table size in db
SELECT table_name AS "table",
round(((data_length + index_length) / 1024 / 1024), 2) "size(MB)"
FROM information_schema.TABLES
WHERE table_schema = "$dbName"
ORDER BY (data_length + index_length) DESC;
@ssskip
ssskip / mime.types
Created July 9, 2015 03:53
mime.types with woff2 support
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/x-font-woff woff;
@ssskip
ssskip / nginx.conf
Last active August 29, 2015 14:25 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers