Skip to content

Instantly share code, notes, and snippets.

View kostasx's full-sized avatar
💭
Uncaught ReferenceError

Kostas Minaidis kostasx

💭
Uncaught ReferenceError
View GitHub Profile
@kostasx
kostasx / slim-redux.js
Created May 5, 2023 09:30 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@kostasx
kostasx / redux-light-example.js
Created January 11, 2023 08:32 — forked from bloodyowl/redux-light-example.js
redux in 14 lines of code
const store = createStore((state = { counter: 0 }, action) => {
switch(action.type) {
case "INCREMENT":
return { counter: state.counter + 1 }
case "DECREMENT":
return { counter: state.counter - 1 }
default:
return state
}
})
@kostasx
kostasx / eu_members.json
Last active November 21, 2022 11:12 — forked from PoeHaH/gist:ab9d8ac1b4ddee168d4d96c71797df31
JSON representation of EU countries, 2 letter codes
[
{ "country": "Austria", "code": "AT" },
{ "country": "Belgium", "code": "BE" },
{ "country": "Bulgaria", "code": "BG" },
{ "country": "Croatia", "code": "HR" },
{ "country": "Cyprus", "code": "CY" },
{ "country": "Czech Republic", "code": "CZ" },
{ "country": "Denmark", "code": "DK" },
{ "country": "Estonia", "code": "EE" },
{ "country": "Finland", "code": "FI" },
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua and Barbuda
Argentina
Armenia
Australia
Austria
@kostasx
kostasx / erc721-example.sol
Created November 23, 2021 21:39 — forked from aunyks/erc721-example.sol
My implementation of the ERC721 token standard. WARNING: THIS CODE IS FOR EDUCATIONAL PURPOSES. DO NOT DEPLOY TO THE NETWORK.
pragma solidity ^0.4.19;
contract ERC721 {
string constant private tokenName = "My ERC721 Token";
string constant private tokenSymbol = "MET";
uint256 constant private totalTokens = 1000000;
mapping(address => uint) private balances;
mapping(uint256 => address) private tokenOwners;
mapping(uint256 => bool) private tokenExists;
mapping(address => mapping (address => uint256)) private allowed;
mapping(address => mapping(uint256 => uint256)) private ownerTokens;
contract ERC721 {
// ERC20 compatible functions
function name() constant returns (string name);
function symbol() constant returns (string symbol);
function totalSupply() constant returns (uint256 totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
// Functions that define ownership
function ownerOf(uint256 _tokenId) constant returns (address owner);
function approve(address _to, uint256 _tokenId);
function takeOwnership(uint256 _tokenId);
@kostasx
kostasx / _tsne.pdf
Created February 28, 2021 17:36 — forked from kylemcdonald/_tsne.pdf
Exploring antonyms with word2vec.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"embeddings": [
{
"tensorName": "Reviews Sentiment Analysis Vector Space",
"tensorShape": [
1000,
50
],
"tensorPath": "https://gist.githubusercontent.com/kostasx/0af4f6303ff6821476543366904e4b21/raw/1357a73b5a75fbb8d49646b471a9d19470d9238e/embedding-projector--vecs.tsv",
"metadataPath": "https://gist.githubusercontent.com/kostasx/8aa6c86651ca73d0455d546c8b2a078e/raw/61dceae3f45fd1abf7eb16964c2f92fda30ac464/embedding-projector--meta.tsv"
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 16 columns, instead of 8 in line 5.
0.11199197 -0.003564898 0.28838375 -0.02453965 -0.060024902 -0.0721752 0.084433 0.04048575 -0.0048353043 -0.010357111 -0.24254088 0.123872384 0.06795292 0.058354862 -0.0924278 0.25570905
0.087117806 -0.057186488 0.24222723 0.0046102796 0.054156974 -0.03447769 0.09587353 -0.015675819 0.009703704 -0.06351056 -0.16185245 0.097795 0.07845944 0.04366533 -0.043812513 0.20302159
-0.12033286 0.19545701 0.31732923 0.18137869 -0.1491861 0.22615197 -0.18394953 -0.22844425 0.23483802 0.17303562 -0.24325718 -0.15418604 -0.17959246 -0.18284406 -0.23760289 0.35320896
0.019094488 0.05589215 0.27747035 0.0093216635 -0.03744544 0.064165235 0.04416203 -0.00037242024 0.068225645 0.01665077 -0.22317336 0.057856657 -0.042340375 -0.035009976 -0.101763465 0.28485936
0.16710165 -0.06288179 0.22370918 -0.04430955 0.008299133 -0.12387165 0.117996536 0.022873737 -0.08183648 -0.11078356 -0.15378515 0.14609973 0.1264015 0.11722314 -0.062144615 0.13573056
0.093750045 -0.036193356 0.06635687 -0.09512182 0.025961913 -0.07996079 0.08794111 0.
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
<OOV>
the
and
i
it
a
is
to
this
was