In English class, our foreign teacher introduced us to the card game Rummy. This game has no official rules, so there are many variations among players. The rules our teacher taught us are as follows: The game requires at least one deck of playing cards, depending on the number of players, with all jokers removed. At the start, each player is dealt 7 cards. After dealing, flip the top card from the deck and place it aside. During each player's turn, they must perform the following actions: Choose to take the top card from the face-down deck or take any number of cards from the face-up discard pile. When taking cards from the discard pile, you must use the bottommost card you picked up during this turn according to condition 2 below. (Cannot keep it in hand or discard it)...
A Javascript for time crowdfunding calculation
In the ancient Eastern land imbued with mysterious magical powers, each minute passes in 59 seconds. var toad = new Date () var secondsDonated = Math . floor (( toad . getTime () + 1368835200000 ) / 59000 ) toad . setTime ( toad . getTime () + secondsDonated * 1000 ) toad . toLocaleString () -1368835200 is the UNIX timestamp of his birthday, with additional zeros appended since JavaScript calculates time in milliseconds. By donating your time, you become equivalent to someone living in outside China. You and every individual have collectively donated seconds. This translates to years, days, hours, minutes and seconds. function crowdFund() { var toad = new Date(); var secondsDonated = Math.floor((toad.getTime() + 1368835200000) / 59000); $('#time-crowdfund-donated').text(secondsDonated)...

Adding a Cool Web Background with Canvas-Nest.js
Today on Advanced Blog , I discovered a stunning webpage background effect where dynamic lines form triangles and other geometric patterns that respond to mouse movements. To implement this on your own site, simply add the following code before </body> : <script src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script> Refresh the page to see the effect. If it doesn't appear, verify the placement – this code must not be inserted between <head> and </head> ! However, this introduces an issue: when server-to-user speeds are slow (e.g., during peak-hour network congestion between China and the US), the browser won't detect the need to load this JavaScript until reaching the code's position near the page bottom. Consequently,...

Adding an Easter Egg in "Developer Tools"
In Chrome Developer Tools, there's a section called the "Console" where we can add some Easter egg messages, for example: Welcome to Lan Tian @ Blog. If you can see these lines, then you definitely don't have a girlfriend. These messages can be output using JavaScript with the following implementation code: if ( window . console ){ var cons = console ; if ( cons ){ cons . warn ( '%cWelcome to Lan Tian @ Blog.' , 'color:#09f' ); cons . warn ( 'If you can see these lines,' ); cons . warn ( 'then you definitely don \' t have a girlfriend.' ); } } When cons.warn takes only one parameter, it outputs that sentence in the console. If it takes two parameters and the first parameter (the message) starts with %c , then the second parameter is CSS code. Using cons....
JS Check-in for Social Comment Systems
Inspired by WP Blog One-click Check-in JS , I modified the JS code to implement one-click check-in functionality for Youyan and Duoshuo comment systems. Youyan Version: javascript : try { document . getElementById ( 'uyan_l_uname' ). value = 'Your Nickname' } catch ( err ) {} var myDate = new Date () var mytime = myDate . toLocaleTimeString () document . getElementById ( 'uyan_comment' ). value = 'Checked in today! Time: ' + mytime UYAN . addCmt ( document . getElementById ( 'uyan_cmt_btn' )) void 0 Usage: Open a page with Youyan and click once. Can be used without login, or after logging in via Weibo first. Duoshuo Version: javascript : var myDate = new Date () var mytime = myDate . toLocaleTimeString () document . getElementsByName ( 'message' ). item ( 0 )....
One-Click Check-in JS for WordPress Blog
This is something I came across on Arefly's blog. Original URL: http://www.arefly.com/zh-cn/wordpress-js-check/ Usage: Bookmark any webpage. Find the bookmark you just created, right-click to edit it. Change the name to "One-Click Check-in" or whatever you prefer, and replace the address with the following code: javascript : document . getElementById ( 'author' ). value = 'Your Nickname' document . getElementById ( 'email' ). value = 'Your Email' document . getElementById ( 'url' ). value = 'Your Website' var myDate = new Date () var mytime = myDate . toLocaleTimeString () document . getElementById ( 'comment' ). value = 'Checked in today! Time: ' + mytime submit . click () void 0 Remember to modify the nickname, email, and website in the code. Open the webpage where you want to check in,...

Image Zoom Effect on Mouse Hover
Image zoom effect on hover - Original by Maomihz , Modified by Lan Tian Last night Maomihz asked me to modify a jQuery script to achieve an automatic HD image display effect when hovering over thumbnails. There were two initial bugs: the enlarged image would flicker when hovering over the frame, and the image would exceed the top edge of the screen. My solution was to place the enlarged image under the thumbnail and set a semi-transparent effect for the thumbnail. The top-edge overflow issue was easily resolved by implementing a max() function. Here's the jQuery code: $ ( function () { var x = 22 var y = 540 var a = 0 $ ( 'a.smallimage' ). hover ( function ( e ) { if ( a == 0 ) { $ ( 'body' ). append ( '<div id="bigimage"><img src="' + this . rel + '" alt="" /></div>' )...