Skip to content

Instantly share code, notes, and snippets.

View wangkeluo's full-sized avatar

Keluo Wang, Corot wangkeluo

  • Nikoyo
  • Hong Kong
View GitHub Profile

Mark.Huang @ 2015/08/19

css 的优先级

CSS priority, you can refer to developer console style info, it shows priority, the topest is the highest priority, which html tag style should take precedence over CSS, multiple CSS depends on loading sequence. Seems last loaded will take effect, but mostly, they are computed result, effects may come from multiple CSS files

what is the essential setting to make a div stay where it should be?

DIV, or in general, all html tags, except few one, are using same "rendering" principle, their position, depends on the type of positioning methods (fixed, absolute, relative, default etc), combined with other settings, it is not two dimension, but at least three dimensions, z-index controls which on the top. What I mean at least three dimensions, because you sometimes need to think about animation, which is time factor

why is childen element out of the region of its parent in common?how to make children always inside the region of its parent element?

A bit related

// Promise interface :
// The first argument fulfills the promise, the second argument rejects it. We can call these functions, once our operation is completed.
function imgLoad(url) {
return new Promise(function(resolve, reject) {
// Create new promise with the Promise() constructor;
// This has as its argument a function
// with two parameters, resolve and reject
var request = new XMLHttpRequest();
request.open('GET', url);
// Create an object type UserException
function UserException (message){
this.message=message;
this.name="UserException";
}
// Make the exception convert to a pretty string when used as a string
// (e.g. by the error console). Override default toString method
UserException.prototype.toString = function UsertoString() {
return this.name + ': "' + this.message + '"';
<?php
/* PUT data comes in on the stdin stream */
$putdata = fopen("php://stdin", "r");
/* Open a file for writing */
$fp = fopen("myputfile.ext", "w");
/* Read the data 1 KB at a time
and write to the file */
while ($data = fread($putdata, 1024))
When uploading multiple files, the $_FILES variable is created in the form:
Array
(
[name] => Array
(
[0] => foo.txt
[1] => bar.txt
)
$fn = (isset($_SERVER['HTTP_X_FILENAME']) ? $_SERVER['HTTP_X_FILENAME'] : false);
if ($fn) {
/*
AJAX call
If filename does not exist, the file is created. Otherwise, the existing file is overwritten, unless the FILE_APPEND flag is set.\
*/
file_put_contents(
'uploads/'. $fn,
/*
file_get_contents() returns the file in a string, starting at the specified offset up to maxlen bytes. On failure, file_get_contents() will return FALSE.
<?php
$uploads_dir = '/uploads';
foreach ($_FILES["upload-file-name"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, "$uploads_dir/$name");
}
}
?>
@wangkeluo
wangkeluo / rfc6749.md
Last active August 29, 2015 14:24 — forked from yorkxin/rfc6749.md
Internet Engineering Task Force (IETF)                     D. Hardt, Ed.
Request for Comments: 6749                                     Microsoft
Obsoletes: 5849                                             October 2012
Category: Standards Track
ISSN: 2070-1721

The OAuth 2.0 Authorization Framework

Abstract

<script type = "text/javascript">
$(function(){
events.init();
});
var events = {
checkFilled: function isFilled(field){},
checkEmail: function isEmail(field){},
checkPasswordConsistant: function isConsistant(field1,field2){},
@wangkeluo
wangkeluo / css_resources.md
Last active August 29, 2015 14:24 — 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