This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2011 Google Inc. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
module.exports = { | |
entry: { | |
app: './entry.js' | |
}, | |
output: { | |
path: __dirname, | |
publicPath: '/assets/', | |
filename: "[name].bundle.js" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head><title>Static Positioning</title> | |
<link href="style.css" rel="stylesheet" type="text/css"> | |
</head> | |
<body class="element"> | |
<ul> | |
<li data-selector="element" class="selected">h2</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2011 Google Inc. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSArray *) sortArray: (NSArray *) sortingArray withValuesInArray: (NSArray *) sorterArray{ | |
//We will create a NSDictionary using the second array as keys and the first array as values | |
NSDictionary *sortingDictionary = [NSDictionary dictionaryWithObjects:sorterArray forKeys:sortingArray]; | |
//Then we just create a new array sorted by the keys of the dictionary | |
NSArray *sortedArray = [sortingDictionary keysSortedByValueUsingComparator: ^(id value1, id value2) { | |
NSInteger number1 = [value1 integerValue]; | |
NSInteger number2 = [value2 integerValue]; | |
if (number1 > number2) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Each of the following options will create a new empty object: | |
var newObject = {}; // or | |
var newObject = Object.create(null); // or | |
var newObject = new Object(); | |
// four ways in which keys and values can then be assigned to an object | |
// ECMAScript 3 compatible approaches | |
// 1. Dot syntax | |
newObject.someKey = 'Hello World'; // Write properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Constants Construction | |
* @description 可以直接用全大寫的naming convention來模擬,此處實際建立一個指定常數的實作 | |
* @return {[type]} [description] | |
*/ | |
// Using naming convention directly | |
var Widget = function() { | |
// implement...... | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HTML5 DOCTYPE | |
<!DOCTYPE html> | |
<html> | |
.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Used to synchronize multiple types of storage and their timestamps. | |
options{ | |
data : {}, the state that all storage should take. | |
date: int, the modified date that all storage should take | |
interval : int, sync interval in milliseconds. | |
callbacks : [], an ARRAY of callback functions which are to each be executed with data | |
and date as params. Each callback should be used to update a single storage medium. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$(document).on('.ajaxModal', 'click', function(event) { | |
$.get($(this).attr('href'), function(response) { | |
$('<div class="modal hide fade">' + response + '</div>').modal(); | |
}); | |
event.preventDefault(); | |
}); | |
}); |