Skip to content

Instantly share code, notes, and snippets.

View jussiry's full-sized avatar

Jussi Rytkönen jussiry

View GitHub Profile
@jussiry
jussiry / pod.js
Last active April 28, 2020 09:52
#! js
// Peritään yleisiä kieli ominaisuuksia lang-moduulista
Object.setPrototypeOf(pod, :lang)
// Kääntäjä saa lähdekoodin ja käännettyään palauttaa javascript koodia
pod.compiler = (sourceString, moduleName) => {
// Kääntämisen lisäksi voidaan ajaa mitä vaan koodia,
// tässä tapauksissa muuttaa editorissa olevaa koodia
// (ensin varmistetaan että ollaa muokkaamassa ks. moduulia)
@jussiry
jussiry / photos.js
Created March 23, 2020 12:40
Examples on using GUN js
var Gun = require('gun');
var gun = Gun('https://gun-eu.herokuapp.com/gun'); // connect to gun-eu peer (UI prototype also connects to this peer)
// Photos are stored in root -> starling -> photos -path
var photosPath = gun.get('starling').get('photos');
// UNCOMMENT next line to see results, explanation below:
//photosPath.once((res) => console.log(res))
/*

Keybase proof

I hereby claim:

  • I am jussiry on github.
  • I am jussir (https://keybase.io/jussir) on keybase.
  • I have a public key ASDvGjGehVp8UuSMgtC55wFhDrHuT175M0VhN6HODCCsuwo

To claim this, I am signing this object:

@jussiry
jussiry / music.lib.js
Created November 27, 2019 16:53
Music lib example
<html>
<head>
<title>Music makers HTML test</title>
</head>
<body>
<textarea style="width: 20em; height: 20em;">
{"instrument": "guitar-electric", "distortion": 0.4}
sdfsdfsdfsdf
{"instrument": "guitar-acoustic", "distortion": 0}
var global = typeof global !== 'undefined' ? global : window;
global.edide = {};
"use strict";edide.set = (function _set (edide) {
return (...args) => new Set(args)
return this;
}).call({}, edide);
//# sourceURL=set-1
"use strict";edide.inEditor = (function _inEditor (edide) {
@jussiry
jussiry / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../paper-calculator/paper-calculator.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@jussiry
jussiry / printbit.js
Created August 12, 2013 17:25
Learn bitwise operations with this helper function
window.printbit = function(){
var saBits = [],
naLengths = [];
for (var i=0; i<arguments.length; i++) {
var arg = arguments[i];
if (typeof arg == 'string') {
saBits.push(eval(arguments[i-2]+arg+arguments[i-1]).toString(2));
arguments[i] = arguments[i-2]+arguments[i]+arguments[i-1];
} else {
saBits.push(arg.toString(2));
@jussiry
jussiry / api_parser.js
Created October 16, 2012 14:30
Parse Kovalo API data
/**
* Retrieves data from Kovalo API and changes id references to object references.
*/
$.get("http://kovalo-grape.herokuapp.com/deals/near?latitude=60&longitude=24&radius=60", function(res) {
var check_key, data_root_obj, iterator, key, model_name, non_data_root_child;
// set the location/name of root object where the data will be stored:
data_root_obj = window.Data = {};
// helper(s)
@jussiry
jussiry / organic_coffee
Created January 30, 2012 18:35
Organic Coffee
reserved words
if unless else then when is be becomes act function
act / function
denoted with keyword act (or function) or with indentation
e.g. word_array search! word act word length is 5
when denoted with intendation, first row can be used to define parameters, e.g.
word_array search!
word
word lengt < 5
@jussiry
jussiry / scatter_script.js
Last active September 28, 2015 08:18
Get global JS vars of any web app
// Open a console of you browser* and copy-paste this script to it. You'll get a scatter score
// (how many global variables that applications creates) and easy acces to those variables.
// * optimised for Chrome and Firefox; different browsers can have different
// default variables, that this script don't hide.
(function() {
var default_vars = {"window":true,"document":true,"console":true,"getInterface":true,"constructor":true,"InstallTrigger":true,"location":true,"_FirebugCommandLine":true,"addEventListener":true,"removeEventListener":true,"dispatchEvent":true,"dump":true,"name":true,"parent":true,"top":true,"sessionStorage":true,"localStorage":true,"globalStorage":true,"getComputedStyle":true,"getSelection":true,"scrollByLines":true,"length":true,"self":true,"history":true,"locationbar":true,"menubar":true,"personalbar":true,"scrollbars":true,"statusbar":true,"toolbar":true,"status":true,"close":true,"stop":true,"focus":true,"blur":true,"opener":true,"frameElement":true,"navigator":true,"applicationC