Skip to content

Instantly share code, notes, and snippets.

@yuktse
yuktse / css_resources.md
Created February 25, 2014 08:09 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@yuktse
yuktse / javascript_resources.md
Created February 25, 2014 08:09 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@yuktse
yuktse / get_scroll_offset.js
Created February 25, 2014 09:02
js 获取页面滚动高度
var scrollTop = window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop
|| 0;
var scrollLeft = window.pageXOffset // netscape
|| document.documentElement.scrollLeft
|| document.body.scrollLeft
|| 0;
/*
@yuktse
yuktse / js OOP 继承.md
Created February 25, 2014 09:15
js 实现 OOP 的继承

js中实现OOP的继承,方法有很多,记录其中一种以备忘。

  // 定义基类构造函数
  var Product = function(type,price){
    this.type = type
    this.price = price // 函数中的this指代调用本函数的对象
  }
 
@yuktse
yuktse / div_content_scroll.html
Created February 25, 2014 09:37
区域内容自动垂直滚动。基本原理是:滚动完后上方不可见元素放回队列的后面。
<style>
#friend_links dd{line-height: 20px}
</style>
<div style="float:left; width: 1000px; height: 20px;" id="friend_links">
<dd><a href="#">美丽说1</a></dd>
<dd><a href="#">磨菇街2</a></dd>
<dd><a href="#">美丽说3</a></dd>
<dd><a href="#">磨菇街4</a></dd>
<dd><a href="#">美丽说5</a></dd>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script>
$(function(){
$('#sn').focus();
/**
* it is a sample to prevent the enter key sent by barcode scaner submitting the form.
* chrome18, ie8, firefox14 passed tests
*/
@yuktse
yuktse / jquery_ajax.js
Created February 25, 2014 09:44
jquery 常用 ajax
$.ajax({
url:"<?=url('flight/searchTips')?>",
data:id + "=" + tips,
dataType:'json',
type:'post',
success:function (res) {
if (res.ack == 'ok') {
$('#' + id + 'Search').html(data.content).css("display", "block");
}
else {
@yuktse
yuktse / fix_js_float_point_cal_bug.js
Created February 25, 2014 09:46
js浮点运算bug解决方案
function accDiv(arg1, arg2) {
var t1 = 0, t2 = 0, r1, r2;
try {
t1 = arg1.toString().split(".")[1].length
} catch (e) {
}
try {
@yuktse
yuktse / 快速转换PHP程序到CLI环境.md
Created February 25, 2014 09:53
快速转换PHP程序到CLI环境

1. 捕获参数,组装伪$_GET和$_REQUEST数组

php filename.php "name=Roges&height=187.96&weight=99.79"

注意,命令行中使用&符号时,必须要将其用引号括住,否则你会有意外的惊喜。

2. 在文件头部加入组装逻辑

@yuktse
yuktse / Helper_Devel.php
Created February 25, 2014 09:58
Helper codes in development
<?php
function dump($var, $label = null){
if($label) echo "<b>$label</b>";
echo '<pre>';
print_r($var);
echo '</pre>';
}
class Runtime
{