- AI Shift
- 社内SQL研修のために作った資料を公開します - (2021/06/21)
- CARTA HOLDINGS(旧VOYAGE GROUP)
- 技術広報が新卒研修<Open AIハッカソン>をスパイしてみた - (2023/04/11)
- @t_wadaに学ぶテスト駆動開発【CARTA 23新卒研修】 - (2023/04/19)
- 【新卒研修】監修者@t_wadaと読む!プログラマが知るべき97のこと読書会 - (2024/04/09)
- Classi
- 当たり前にリリースしていく ~ 新卒研修編 - (2021/05/20)
- リモートワークのための質問力向上研修を実施しました - (2021/12/07)
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
<?php | |
// 生成给定概率的随机对象 - php版 | |
// $a = array('一等奖:宝马X6', '二等奖:苹果三件套', '三等奖:威戈背包', '继续努力!'); | |
// $b = array(1,0,1,0); | |
// $re = goodluck($a,$b); | |
function goodluck($obj,$luck){ | |
$sum = 0; | |
$factor = 0; | |
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
/*obj 概率对象数组; | |
luck 概率数组,即obj数组元素意义对应; | |
对于给定的概率对象,该函数可简化如下: | |
var a = ['一等奖:宝马X6', '二等奖:苹果三件套', '三等奖:威戈背包', '继续努力!']; | |
var b = [1, 10, 100, 500]; | |
function goodluck(a, b) { | |
var random = (1 + 10 + 100 + 500) * Math.random(); | |
if(random <= 500) return a[3]; | |
else if(random <= 600) return a[2]; |
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
//参考 http://www.devinrolsen.com/basic-jquery-touchmove-event-setup/ | |
//jQuery API 说明 http://api.jquery.com/category/events/event-object/ | |
$('#someElm').bind('touchmove',function(e){ | |
e.preventDefault(); | |
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; | |
var elm = $(this).offset(); | |
var x = touch.pageX - elm.left; | |
var y = touch.pageY - elm.top; | |
if(x < $(this).width() && x > 0){ |