Skip to content

Instantly share code, notes, and snippets.

View nektro's full-sized avatar
🌻
if you know, you know

Meghan Denny nektro

🌻
if you know, you know
View GitHub Profile
<?php
function convBase($numberInput, $fromBaseInput, $toBaseInput)
{
if ($fromBaseInput==$toBaseInput) return $numberInput;
$fromBase = str_split($fromBaseInput,1);
$toBase = str_split($toBaseInput,1);
$number = str_split($numberInput,1);
$fromLen=strlen($fromBaseInput);
$toLen=strlen($toBaseInput);
$numberLen=strlen($numberInput);
@nektro
nektro / Lifinator.java
Last active April 13, 2016 03:18
Turn images into life files
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Lifeinator
{
public static void main(String[] args)
@nektro
nektro / custom_element.html
Created January 14, 2017 07:18
access the dom inside html imports
<script>
const importDoc = document.currentScript.ownerDocument;
</script>
@nektro
nektro / CoolioVirus.java
Last active January 28, 2017 05:32
Coolio Albainian Virus meme
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class CoolioVirus
{
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
{
String title = "Virus Alert !";
String message = "Hi, I am an Albanian virus but because of poor technology in my\n" +
@nektro
nektro / install_composer.sh
Created July 9, 2017 02:29
Installer shell scripts
#!/usr/bin/env bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
@nektro
nektro / bin2.js
Last active October 16, 2017 02:25
algorithm 3.2
function bin2(n, k)
{
const B = new Array(n+1).fill(0).map((x) => {
return new Array(k+1).fill(0);
});
for (let i = 0; i <= n; i++) {
for (let j = 0; j <= Math.min(i,k); j++) {
if (j === 0 || j === i) {
B[i][j] = 1;
.square:after {
content: "";
display: block;
padding-bottom: 100%;
}
@nektro
nektro / lucky_numbers.js
Last active February 13, 2018 12:19
Find the [Lucky Numbers](https://en.wikipedia.org/wiki/Lucky_number) up to a certain `n`
function getLuckNumbersTo(n, d=false) {
const start = Date.now();
let lucky = new Array(n).fill(0).map((v,i) => i+1);
if (d) console.log(lucky);
for (let i = 2; i < lucky.length;) {
for (let j = i; j <= lucky.length; j+=i) {
lucky.splice(j-1, 1, 0);
}
lucky = lucky.filter(v => v !== 0);
if (d) console.log(i, lucky);
<!doctype html>
<html>
<head>
<title>edge iframe memory test</title>
<style>
body {
margin: 0;
overflow-x: hidden;
}
iframe {
@nektro
nektro / _uikit.js
Created March 23, 2018 07:15
Bootstrapping HTML
//
'use strict';
import { create_element } from "https://rawgit.com/Nektro/modules.js/439458f/src/create_element.js";
export function createUIWindow(model) {
const view = model.map(x => createComponent(x));
for (const ele of view) {