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 counter = 1; | |
| var startX = null, startY = null; | |
| view.addEventListener('touchstart', function(e){ | |
| startX = e.x, startY = e.y; | |
| }); | |
| view.addEventListener('touchmove', function(e){ | |
| if((counter % 5) == 0){ | |
| var x = (e.x - startX) + view.animatedCenter.x; | |
| var y = (e.y - startY) + view.animatedCenter.y; | |
| view.animate({top:y-viewHeight/2, left:x-viewHeight/2, duration:1}); |
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
| wal_level = hot_standby | |
| max_wal_senders = 2 #レプリケーション中に再度ベースバックアップをしたい場合の保険にスレーブ数+1に設定 | |
| synchronous_standby_names = 'slave1' #今回はスレーブ側でスレーブ名をslave1に設定 |
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 win = Ti.UI.currentWindow; | |
| // 仮データ | |
| var dataList = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]; | |
| // 参照データを表示するラベル | |
| var dataLabel = Titanium.UI.createLabel({ | |
| backgroundColor: 'black', | |
| borderRadius: 30, | |
| color:'white', |
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 runTime = 1000; | |
| $("runner").animate({left: "350px"}, runTime); // runTime時間分かけた何らかの処理 | |
| setTimeout(function(){ | |
| alert("完了"); | |
| }, runTime); // runTime時間分処理を待つ |
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
| library(mlbench) | |
| library(kernlab) | |
| n <- 200 #データ数 | |
| k <- 10 #分割数 | |
| dat <- mlbench.spirals(n, cycles=1.2, sd=0.16) #データ生成 | |
| x <- dat$x; y <- dat$classes | |
| idx <- sample(k, n, replace=TRUE) | |
| sigma.list <- seq(0.1, 15, by=0.1) | |
| cv <- c() | |
| for(sigma in sigma.list) { |
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
| Titanium.Media.openPhotoGallery({ | |
| success: function(event) { | |
| // アプリケーションデータディレクトリに出力する。 | |
| var f = Ti.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory + "/" + 'name.png'); | |
| if (!f.exists()) { | |
| f.createFile(); | |
| } | |
| f.write(event.media); | |
| }, | |
| error: function(error) { |
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 win = Ti.UI.currentWindow; | |
| //今日という日 | |
| var now = new Date(); | |
| now.setHours(12); | |
| var Y = now.getYear()+1900; | |
| var M = now.getMonth()+1; | |
| //表示している画面の年と月 | |
| var whenLabel = Ti.UI.createLabel({ |
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
| <input type="button" value="A" id="buttonA" > | |
| <input type="button" value="B" id="buttonB" > | |
| <script> | |
| var objectA = new function () { | |
| this.alertMessage = "Hello world!"; | |
| this.ClickHandler = function() { | |
| alert(this.alertMessage ); | |
| } | |
| }; | |
| document.getElementById("buttonA").onclick = objectA.ClickHandler //undefined |
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 num = 10; | |
| var str = "10"; | |
| alert(num == str); //true | |
| alert(num === str); //false |