Skip to content

Instantly share code, notes, and snippets.

View citylims's full-sized avatar
🎯
Focusing

Austin Formica citylims

🎯
Focusing
View GitHub Profile
function frame(){
$.fillStyle = "hsla(0,5%,5%,1)";
$.fillRect(0, 0, w, h);
$.fillStyle = "hsla(" + (ŭ % 360) + ",100%,50%,1)";
$.globalAlpha = .8;
var gravX = msX;
var gravY = msY;
var f = first;
function id() {
return Math.random().toString(16).substring(2, 10);
}
@citylims
citylims / anagram_detector.js
Created February 18, 2015 15:10
Anagram Detector
var array = ["enlists", "google", "inlets", "banana"];
function anagram(word, array) {
var word = word.split('').sort().join('');
for(var i = 0; i < array.length; i++) {
var checking = (array[i].split('').sort().join(''));
word === checking ? console.log(array[i], true) : false;
}
}
function encode(message){
var rail1=[];
var rail2=[];
var rail3=[];
var message = message.split(' ').join('');
console.log(message)
for( var i = 0; i < message.length; i++ ){
if(i % 4 == 0 ){
rail1.push( message[i] );
}
@citylims
citylims / Vigenère cipher.js
Last active August 29, 2015 14:15
Warm-up JS exercise to start off the day - Vigenère Cipher
function encryptMessage(message, keyword) {
var cipher = [];
var alpha = 'abcdefghigklmnopqrstuvwxyz'.split('');
var alphaLength = alpha.length;
//split input
var message = message.split('');
var keyword = keyword.split('');
//config for key position
var keyIndex = 0;
var keyLength = keyword.length;