(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| def index(conn, %{"event" => "true"}) do | |
| conn = conn | |
| |> put_resp_content_type("text/event-stream") | |
| |> send_chunked(200) | |
| {:ok, conn} = chunk(conn, ["data: ", JSON.encode!(Thermostat.Data.get()), "\n\n"]) | |
| Phoenix.Topic.subscribe self, "data" | |
| data_updated(conn) | |
| end | |
| defp data_updated(conn) do |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| M[16],X=16,W,k;main(){T(system("stty cbreak") | |
| );puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i | |
| ,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M | |
| [w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<< | |
| (l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k) | |
| ]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d | |
| -1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X] | |
| *i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4; | |
| )s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4|| | |
| puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2 |
| #!/usr/bin/env python | |
| from os.path import isfile | |
| from sys import argv | |
| from time import sleep | |
| import commands | |
| import select | |
| suffix = argv[1] if len(argv) > 1 else "" |
| all:consumer producer | |
| CPPFLAGS+=-std=c++03 -Wall -pedantic | |
| CPPFLAGS+=-g -O0 | |
| CPPFLAGS+=-isystem ~/custom/boost/ | |
| LDFLAGS+=-L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib | |
| LDFLAGS+=-lboost_system -lrt -lpthread | |
| %:%.cpp |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| # Basically the nginx configuration I use at konklone.com. | |
| # I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com | |
| # | |
| # To provide feedback, please tweet at @konklone or email [email protected]. | |
| # Comments on gists don't notify the author. | |
| # | |
| # Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites. | |
| # Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration. | |
| server { |
| // Just before switching jobs: | |
| // Add one of these. | |
| // Preferably into the same commit where you do a large merge. | |
| // | |
| // This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
| // and then it quickly escalated into more and more evil suggestions. | |
| // I've tried to capture interesting suggestions here. | |
| // | |
| // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
| // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
This tutorial is about using and creating 'scripts' in Toribash. In this first tutorial I will be covering what scripts are, how to use them, how they are made and what tools you will need to make them.
There is a very simple exercise at the end of the tutorial that will test what you have learned.
The proceeding tutorials will then go into detail about how to make scripts, including going over the basics of programming.
These tutorials are created for people with no experience in programming, but are also recommended for people who know programming but are not sure in how to create scripts specifically for Toribash