This file contains 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
<?php | |
/** | |
* I rewrote quickly a Vector class, reinventing the wheel sorry :) | |
*/ | |
class Vector implements arrayaccess{ | |
private $_x = array(); | |
public function offsetExists ( $offset ){ | |
return isset($this->_x[$offset]); | |
} | |
public function offsetGet ( $offset ){ |
This file contains 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
<?php | |
function swap($array, $a, $b) { | |
if( empty($array) || !is_array($array) ){ | |
return $array; | |
} | |
$j = count($array); | |
$ael = array($array[$a]); | |
$bel = array($array[$b]); |
This file contains 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
#!/bin/perl | |
# use warnings; | |
use Data::Dumper; | |
$num_args = $#ARGV + 1; | |
if ($num_args != 2) { | |
print "\nUsage: ./seokw.pl corpusA corpusB\n"; | |
exit; | |
} |
This file contains 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
// Arduino Uno source | |
int keyInterrupt = 2; | |
volatile int row = -1; | |
volatile int col = -1; | |
void setup() { | |
// Open serial communications and wait for port to open: | |
Serial.begin(9600); | |
while (!Serial) {} |
This file contains 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
package main | |
import ( | |
"encoding/xml" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
"strings" | |
) |
This file contains 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
/** | |
* Usage: | |
* new Ticker(timeout: number, (stop: Function) => { | |
* // do stuff every timeout | |
* if (...) {stop()} | |
* }) | |
*/ | |
class Ticker { | |
private ticker: any | |
private handler: Function |
This file contains 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
// Seen on https://stackoverflow.com/a/67905164 | |
var ( | |
required string | |
fooCmd = flag.NewFlagSet("foo", flag.ExitOnError) | |
barCmd = flag.NewFlagSet("bar", flag.ExitOnError) | |
) | |
var subcommands = map[string]*flag.FlagSet{ |
This file contains 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
//go:build ignore | |
// +build ignore | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"io/fs" | |
"io/ioutil" |
This file contains 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
// Simple script that exports a users "Saved For Later" list out of Feedly | |
// as a JSON string. | |
// | |
// This was intended for use in the Google Chrome's "Inspector" tool so your | |
// mileage may vary if used in other contexts. | |
// | |
// Format of JSON is as follows: | |
// [ | |
// { | |
// title: "Title", |