Skip to content

Instantly share code, notes, and snippets.

Avatar
🌻
if you know, you know

Meghan nektro

🌻
if you know, you know
View GitHub Profile
View convBase.php
<?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 Apr 13, 2016
Turn images into life files
View Lifinator.java
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 Jan 14, 2017
access the dom inside html imports
View custom_element.html
<script>
const importDoc = document.currentScript.ownerDocument;
</script>
@nektro
nektro / CoolioVirus.java
Last active Jan 28, 2017
Coolio Albainian Virus meme
View CoolioVirus.java
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 Jul 9, 2017
Installer shell scripts
View install_composer.sh
#!/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 Oct 16, 2017
algorithm 3.2
View bin2.js
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;
View force_square.css
.square:after {
content: "";
display: block;
padding-bottom: 100%;
}
@nektro
nektro / lucky_numbers.js
Last active Feb 13, 2018
Find the [Lucky Numbers](https://en.wikipedia.org/wiki/Lucky_number) up to a certain `n`
View lucky_numbers.js
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);
View evil_iframe.html
<!doctype html>
<html>
<head>
<title>edge iframe memory test</title>
<style>
body {
margin: 0;
overflow-x: hidden;
}
iframe {
@nektro
nektro / _uikit.js
Created Mar 23, 2018
Bootstrapping HTML
View _uikit.js
//
'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) {