Skip to content

Instantly share code, notes, and snippets.

View airyland's full-sized avatar
☀️
Working from home

Airyland airyland

☀️
Working from home
View GitHub Profile
@airyland
airyland / normal way of placeholder
Created May 7, 2011 11:23
normal way of placeholder
<input type="text" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}">
@airyland
airyland / tab.js
Created September 21, 2012 05:51
tag.js
//** Tab Content script v2.0- � Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Updated Oct 7th, 07 to version 2.0. Contains numerous improvements:
// -Added Auto Mode: Script auto rotates the tabs based on an interval, until a tab is explicitly selected
// -Ability to expand/contract arbitrary DIVs on the page as the tabbed content is expanded/ contracted
// -Ability to dynamically select a tab either based on its position within its peers, or its ID attribute (give the target tab one 1st)
// -Ability to set where the CSS classname "selected" get assigned- either to the target tab's link ("A"), or its parent container
//** Updated Feb 18th, 08 to version 2.1: Adds a "tabinstance.cycleit(dir)" method to cycle forward or backward between tabs dynamically
//** Updated April 8th, 08 to version 2.2: Adds support for expanding a tab using a URL parameter (ie: http://mysite.com/tabcontent.htm?tabinterfaceid=0)
////NO NEED TO EDIT BELOW////////////////////////

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@airyland
airyland / test.js
Created October 17, 2012 22:39
test
// 简单嵌入 gist 代码
function gistTest(){
console.log('hello world');
}
@airyland
airyland / dabblet.css
Created October 24, 2012 06:42 — forked from kizu/dabblet.css
No flexbox here
/* No flexbox here */
.wrapper {
background: linear-gradient(rgba(0,0,0,0.7),rgba(0,0,0,0.4));
overflow: hidden;
margin: 0 0 1em;
border-radius: 1em;
}
.pane {
@airyland
airyland / preview.html
Created November 2, 2012 10:08
preview image before upload
<!DOCTYPE html>
<html>
<head>
<meta chraset="utf-8" />
<style type="text/css">
#kk{
width:400px; height:400px; overflow: hidden;
}
#preview_wrapper{
width:300px; height:300px; background-color:#CCC; overflow: hidden;
@airyland
airyland / 1.js
Created November 14, 2012 06:43 — forked from getify/1.js
illustrating some potential issues with adding `let` to code which already has `var` used in it...
// var: poor stylistic form, but no leakage
function foo() {
bar = 3;
if (true) {
var bar = 5;
}
}
// let: will leak an auto-global
function foo() {
@airyland
airyland / 1.js
Created November 14, 2012 06:43 — forked from getify/1.js
more "mental tax": interpreting code that uses `let` in many nested blocks
/*
not terribly difficult to predict which statements print what.
*/
function foo() {
var a, b, c, d;
if (true) {
if (true) {
a = 1;
@airyland
airyland / lazy.js
Created November 18, 2012 06:04
JavaScript Lazy init
var LazySingleton = function(){
var val = 1, _instance;
var lazy_init = function(){
alert('Lazy init, exec no more than once.');
return {
getVal : function(){ return val; },
setVal : function(v){ val = v; }
};
};
var init = function(){
@airyland
airyland / ie10hack.css
Created November 24, 2012 08:15 — forked from atk/ie10hack.css
IE10 hack
/*
#ie10 will only be red in MSIE 10,
both in high contrast (display setting) and default mode
*/
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
#ie10 { color: red; }
}