Skip to content

Instantly share code, notes, and snippets.

@codler
codler / css-supports.js
Last active October 8, 2022 09:32
CSS.supports() Polyfill
/*! CSS.supports() Polyfill
* https://gist.github.com/codler/03a0995195aa2859465f
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
if (!('CSS' in window)) {
window.CSS = {};
}
if (!('supports' in window.CSS)) {
window.CSS._cacheSupports = {};
window.CSS.supports = function(propertyName, value) {
@codler
codler / flex.less
Last active October 7, 2023 07:01
Prefix flex for IE10 and Safari / iOS in LESS
/*! Prefix flex for IE10 and Safari / iOS in LESS
* https://gist.github.com/codler/2148ba4ff096a19f08ea
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
.display(@value) when (@value = flex) {
display: -ms-flexbox; // IE10
display: -webkit-flex; // Safari / iOS
}
.display(@value) when (@value = inline-flex) {
@codler
codler / GIT.md
Last active December 9, 2021 20:52
Useful GIT commands

Setup

git config --global user.name "XXX"		# Full name
git config --global user.email "XXX"	# Email
git config --global github.user XXX		# Username
git config --global github.token XXX	# Token

New rep

/**
* Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2
* within the comfortable framework of the jquery ajax request, with full support for promises.
*
* Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list
* of potential transports (so it gets first dibs if the request passes the conditions within to provide the
* ajax transport, preventing the standard transport from hogging the request), and the * indicates that
* potentially any request with any dataType might want to use the transports provided herein.
*
* Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
http://pastie.org/2054699
@codler
codler / gist:5862854
Created June 25, 2013 22:00
Sort version
['1.0.zip', '1.1.1.zip', '1.1.zip', '1.2.zip'].sort(function(a, b) { console.log('-');console.log(a);console.log(b); return (a.replace('.zip', '') < b.replace('.zip', '')) ? -1 : (a.replace('.zip', '') > b.replace('.zip', '')) ? 1 : 0 })
package com.ab.jersey.dto;
public class AppError {
private String message;
public AppError() { }
public AppError(String message) {
this.message = message;
}
@codler
codler / gist:5383971
Created April 14, 2013 19:56
IRC bot, Node.js v0.6, 2011-12-15 Read and write to both irc and file. Two-way communication.
var util = require('util'),
net = require('net');
fs = require('fs');
vm = require('vm');
repl = require('repl');
var socket = new net.Socket();
socket.setNoDelay(true);
socket.setEncoding('ascii');
@codler
codler / dabblet.css
Created March 26, 2013 08:27
Loading Spinner in CSS
@keyframes wheel {
to { transform:rotate(360deg); }
}
.circularProgress:before {
content: '';
display: inline-block;
width: 50px;
height: 50px;
background:
linear-gradient(0deg, transparent 49%, white 49%, white 51%, transparent 51%) 0 0px,