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
| // реализация пользовательского актёра | |
| class CounterActor implement Runnable { | |
| // ... | |
| // очередь входящих сообщений | |
| // очередей может быть несколько | |
| private final LockFreeStackWithSize<BigInteger> workQueue = | |
| new LockFreeStackWithSize<BigInteger>(); | |
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
| CREATE FUNCTION STRINGDECODE(str TEXT CHARSET utf8) | |
| RETURNS text CHARSET utf8 DETERMINISTIC | |
| BEGIN | |
| declare pos int; | |
| declare escape char(6) charset utf8; | |
| declare unescape char(3) charset utf8; | |
| set pos = locate('\\u', str); | |
| while pos > 0 do | |
| set escape = substring(str, pos, 6); | |
| set unescape = char(conv(substring(escape,3),16,10) using ucs2); |
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
| /** | |
| * Written by Gil Tene of Azul Systems, and released to the public domain, | |
| * as explained at http://creativecommons.org/publicdomain/zero/1.0/ | |
| */ | |
| package org.HdrHistogram; | |
| import java.util.concurrent.TimeUnit; | |
| import java.util.concurrent.atomic.AtomicLongFieldUpdater; | |
| import java.util.concurrent.locks.ReentrantLock; |
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
| This is java websockets exapmle: | |
| Files: | |
| - 01_GameServer.java - start server with Jetty Server inside | |
| - 02_GameSocketServlet.java - mapping to ws://127.0.0.1:8210/gamestate url | |
| - 03_GameSocket.java - handler of websocket connections | |
| - 04_SocketPlayer.java - link between the server and the specific client | |
| - 05_GameApp.java - the game engine | |
| - 06_GameMap.java - map model | |
| - 07_GameSession.java - game session with connected players | |
| - 08_PlayerGameState.java - player's state in a session |
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
| table.matrix,tbody.matrix { | |
| border-style:double; | |
| border-width:3px; | |
| border-color:#000000; | |
| border-spacing:0; | |
| padding:0; | |
| margin:0; | |
| background-color:#aaffff; | |
| } | |
| table.matrix td { |
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 static javax.ws.rs.core.MediaType.APPLICATION_JSON; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.InputStreamReader; | |
| import java.io.OutputStream; | |
| import java.io.PrintWriter; | |
| import java.lang.annotation.Annotation; | |
| import java.lang.reflect.Type; |
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 java.io.BufferedReader; | |
| import java.io.ByteArrayInputStream; | |
| import java.io.ByteArrayOutputStream; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| import java.util.zip.GZIPInputStream; | |
| import java.util.zip.GZIPOutputStream; | |
| public class Gzip { |
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 weather | |
| import smtp | |
| ''' | |
| Send a greeting email to our customer email list | |
| with the daily weather forecast and schedule | |
| ''' | |
| def get_emails(): | |
| # Reading emails from a file |
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
| // to "install" - right click anywhere slack, select "inspect element" | |
| // click "console" in the box that pops up. Down the bottom there's a wide text box with a little blue arrow in it | |
| // copy all of this code - paste it into that text box, press enter. | |
| // good to go! You can close the inspector window | |
| (function go(){ | |
| var isMac = window.navigator.platform.toLowerCase() == 'macintel'; | |
| var cmdKey = isMac ? 'cmd' : 'ctrl'; | |
| var width = 300; |
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
| // GeoChart from https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart | |
| // Try out by pasting code into: https://code.google.com/apis/ajax/playground/?type=visualization#geo_chart | |
| function drawVisualization() { | |
| var data = google.visualization.arrayToDataTable([ | |
| ['State', 'Foo Factor'], | |
| ['US-IL', 200], | |
| ['US-IN', 300], | |
| ['US-IA', 20], |