#慣用的なJavaScript, 矛盾しないコードの書き方
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
<?xml version="1.0"?> | |
<restaurants> | |
<restaurant name="Pan Africa Market" address="1521 1st Ave, Seattle, WA" lat="47.608940" lng="-122.340141" type="sitdown"/> | |
<restaurant name="Buddha Thai & Bar" address="2222 2nd Ave, Seattle, WA" lat="47.613590" lng="-122.344391" type="bar"/> | |
<restaurant name="The Melting Pot" address="14 Mercer St, Seattle, WA" lat="47.624561" lng="-122.356445" type="sitdown"/> | |
<restaurant name="Ipanema Grill" address="1225 1st Ave, Seattle, WA" lat="47.606365" lng="-122.337654" type="sitdown"/> | |
<restaurant name="Sake House" address="2230 1st Ave, Seattle, WA" lat="47.612823" lng="-122.345673" type="bar"/> | |
<restaurant name="Crab Pot" address="1301 Alaskan Way, Seattle, WA" lat="47.605961" lng="-122.340363" type="sitdown"/> | |
<restaurant name="Mama's Mexican Kitchen" address="2234 2nd Ave, Seattle, WA" lat="47.613976" lng="-122.345467" type="bar"/> | |
<restaurant name="Wingdome" address="1416 E Olive Way, Seattle, WA" lat="47.617214" lng="-122.326584" type="bar"/> |
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
<?xml version="1.0"?> | |
<nutrition> | |
<daily-values> | |
<total-fat units="g">65</total-fat> | |
<saturated-fat units="g">20</saturated-fat> | |
<cholesterol units="mg">300</cholesterol> | |
<sodium units="mg">2400</sodium> | |
<carb units="g">300</carb> | |
<fiber units="g">25</fiber> | |
<protein units="g">50</protein> |
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
// Also requires jQuery pasted in the top in Chrome | |
function loadHearts() { | |
$('#speakers').hide(); | |
$('#scene').hide(); | |
$('#schedule td').each(function() { | |
var $talkCell = $(this); | |
var rateLink = $talkCell.find('a'); | |
if (!rateLink.length) return; |
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
import urllib | |
import settings | |
try: | |
import json | |
except ImportError: | |
import simplejson as json | |
class YahooException(Exception): | |
pass |
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
import os | |
input_path = 'application/templates' | |
output_path = 'application/static/js/templates' | |
os.system('mkdir %s' % output_path) | |
dir_list = os.listdir(input_path) | |
for file_name in dir_list: | |
if file_name.endswith('.handlebars'): | |
cmd = 'handlebars %s/%s -f %s/%s' % (input_path, file_name, output_path, file_name.replace('handlebars', '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
These arent always the causes, just in the cases I saw them. | |
Unexpected { | |
Cause: mismatched curly braces, count your braces | |
Unexpected token . | |
Cause: var buttonDiv.bla = 4 | |
SyntaxError: Unexpected string | |
Cause: var bla = bla + ' hi ' ' you' |
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
diff --git a/src/brackets.js b/src/brackets.js | |
index 39e30b2..cb20367 100644 | |
--- a/src/brackets.js | |
+++ b/src/brackets.js | |
@@ -199,7 +199,8 @@ define(function (require, exports, module) { | |
//{"Ctrl-X": Commands.EDIT_CUT}, | |
//{"Ctrl-C": Commands.EDIT_COPY}, | |
//{"Ctrl-V": Commands.EDIT_PASTE}, | |
- | |
+ {"Ctrl-I": Commands.SHOW_OTHER_STUFF}, |
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 (c) 2012 Adobe Systems Incorporated. All rights reserved. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a | |
* copy of this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, including without limitation | |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the | |
* Software is furnished to do so, subject to the following conditions: | |
* |
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
/* | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you 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 |