程序员的新年祝福会是什么样的?我们共收到了97位 OSCer 的回复,以下为支持数排名前十的祝福语:
@yale8848(支持数:10)
document.write("")
(小编:捂脸,不过不知道触感怎么样呢~)
@wuyiw (支持数:4)
以下代码请使用 Chrome 在这个页面(链接)的 console 里面运行~
(function () { const numGraph = { 0: [1, 0, 3, 6, 9, 12, 13, 14, 11, 8, 5, 2], 1: [2, 5, 8, 11, 14], 2: [0, 1, 2, 5, 8, 7, 6, 9, 12, 13, 14], 4: [0, 3, 6, 7, 2, 5, 8, 11, 14], 7: [0, 1, 2, 5, 8, 11, 14] }, nums = '2017'.split('').map(num => numGraph[num]), blockSize = nums.reduce(function (pv, cv) { return pv + cv.length }, 0), pixelPerLine = 3, pixelPerColumn = 5, margin = 30, pixelSize = 40, blockWidth = (margin * 2 + pixelSize * pixelPerLine) * nums.length, imgCls = 'SmallPortrait', interval = 1e2, urlBase = location.href.replace(/\?.*/, ''), origin = location.origin, domParser = new DOMParser() let i = nthBlock = nthNum = nthPos = 0, container, pending = [], done = false, timer = null function advance() { ++i; nthBlock = Math.floor(i / blockSize); ++nthPos; if (nthPos >= nums[nthNum].length) { nthPos = 0; nthNum = (nthNum + 1) % nums.length } } function getCord() { return { top: (margin * 2 + pixelSize * pixelPerColumn) * nthBlock + margin + Math.floor(nums[nthNum][nthPos] / pixelPerLine) * pixelSize, left: (margin * 2 + pixelSize * pixelPerLine) * nthNum + margin + Math.floor(nums[nthNum][nthPos] % pixelPerLine) * pixelSize } } function pend(img) { if (!img.src) { img.src = origin + img.getAttribute('src') } pending.push(img) } function drawPixel() { if (pending.length) { let img = pending.shift(), cord = getCord(), holder = $('<div>', { style: `position: absolute; top: ${cord.top}px; left: ${cord.left}px; width: ${pixelSize}px; height: ${pixelSize}px; box-shadow: 0 0 10px 1px lightblue;` }).appendTo(container).get(0) img.scrollIntoViewIfNeeded() holder.scrollIntoViewIfNeeded() let imgRect = img.getBoundingClientRect(), holderRect = holder.getBoundingClientRect() $('<img>', { src: img.src, style: `position: absolute; top: ${holder.style.top}; left: ${holder.style.left}; width: ${pixelSize}px; height: ${pixelSize}px; transition: .5s; transform: translate(${imgRect.left - holderRect.left}px, ${imgRect.top - holderRect.top}px);` }) .on('load', function () { setTimeout(() => { this.style.transform = '' }, 17) }).appendTo(container) advance() } else if (done) { clearInterval(timer) alert("\u0032\u0030\u0031\u0037\u65b0\u5e74\u5feb\u4e50\u0021") } } function getImgs(query) { fetch(urlBase + query, { credentials: 'include' }) .then(res => res.text()) .then(res => { let doc = domParser.parseFromString(res, 'text/html') Array.from(doc.getElementsByClassName(imgCls)).forEach(pend) let next = doc.querySelector('.page.next a') if (next) { getImgs(next.getAttribute('href')); } else { done = true } }) } function draw() { container = $('<div>', { style: 'position: relative;' }).appendTo($('<div>', { style: `position: fixed; box-sizing: border-box; top: 0; left: 0; overflow-x: hidden; width: 100vw; height: 100vh; padding: 20px calc((100% - ${blockWidth}px) / 2); text-align: center; background: rgba(0,0,0,0.5); z-index: 1024;` }).appendTo(document.body)) getImgs(document.querySelector('.page:not(.prev)').getAttribute('href')) // first page timer = setInterval(drawPixel, interval) } draw() })()(小编:超酷炫!不愧是我们的 JS 小王子,附效果图:
@阿信sxq(支持数:4)
2016><2017>
(小编:感谢来自前端的祝福)
@xiaole…(支持数:3)
for (;;) { print("新年快乐"); }
(小编:满屏的祝福啊,嗯~那就希望新的一年里你能拥有一个更大的显示屏吧)
@乄草民丶(支持数:2)
System.out.println("祝大家新年快乐,新的一年代码无BUG,工作无通宵,工资涨涨涨");
(小编:同一个世界,同一个梦想!)
@孤独的小猪 (支持数:2)
为你编辑快乐的程序,给你安装如意的系统,帮你解开幸福的密码,与你下载好运的软件,新年到了,一切准备就绪,愿你新的一年心情无限好,笑口合不拢。
(小编:兄弟这才华不愁新的一年找不到女朋友啊~)
@机器猫123 (支持数:2)
if 新年
spring start;
print(“新年快乐,屌丝的一年又开始了!”)
else
summser,autumn,winter加班、加班、加班。。。。
end if
(小编:保重身体!)
@叶飞飘渺 (支持数:2)
快乐无需编译,幸福自会运行;美丽没有指令,人生也会计算;心情不必升级,自由自会扩展。2017年,你的幸福数据在加载!
(小编也想来一个:开心快乐stack overflow;悲伤永远null pointer;对象不再404;前途无忧永无bug)
@罗磊-kael(支持数:2)
public static Happy newYear(everyone){
return everyone.doAnything();
}
(小编:原来您是一个心怀天下的“程序员”~)
@东风玖哥 (支持数:2)
祝大家代码bug越来越少,祝OSC越办越好
(小编:感谢各位 OSCer 们的支持!希望我们一起变得更好~)
以上获奖者将获得由华章图书、阿里巴巴提供的计算机图书一本,请及时将联系方式及喜欢的书籍留言@两味真火。
留言格式姓名:xxx地址:xxxx省xxxx市xxxx路xxxx xxxx手机:xxxxxxxxxxx书籍:xxxxxx(可从以下 9 种书籍中任意挑选一本):
除了以上 10 位获得支持数最多的祝福语作者,还有 3 位用户也将获得我们准备的精美图书一本。他们的支持数虽然不多,但是同样诚意满满,来看看他们的祝福语:
@边疆01: public class 程序猿 { public static class 对象 extends Thread { @Override public void run() { System.out.println("码上有对象!!!"); } } public static class 涨工资 implements Runnable { @Override public void run() { System.out.println("月月涨工资!!!"); } } public static void main(String[] args) { System.out.println("Hello World ! Hello 2017!"); System.out.println("祝程序猿:"); new 对象.start(); new Thread(new 涨工资).start(); } }@MrCong:
PHP: echo "2017健康快乐,Bug避退。";
PHP: echo "2017健康快乐,Bug避退。";
OC: NSLog('2017健康快乐,Bug避退。');
C: print("2017健康快乐,Bug避退。");
js: alert("2017健康快乐,Bug避退。");
@挖红薯:
golang:fmt.Println("祝大家新年快乐!")
informix-4GL:DISPLAY "祝大家新年快乐!"
SQL:select '祝大家新年快乐!' from t
请以上幸运参与者将联系方式留言@两味真火,您将收到为我们精心挑选的精美图书!
当然仍然有很多带有满满节日气氛和程序员气息的祝福语,同样感谢没获奖的 OSCer 们的祝福,相信那么多的新年祝福就是你们新年最好的礼物了,同时我们也还会不定期给大家带来福利的哦~
