Skip to content

Instantly share code, notes, and snippets.

View citylims's full-sized avatar
🎯
Focusing

Austin Formica citylims

🎯
Focusing
View GitHub Profile
@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;
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 / 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 id() {
return Math.random().toString(16).substring(2, 10);
}
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;
@citylims
citylims / Ionic Emulate Hack
Created April 10, 2015 20:08
Ionic ios emulate workaround script
#!/bin/bash
# Manually emulate ionic/cordova application
echo "Emulating..."
cd ./platforms/ios/build/emulator
var=$(pwd)
ios-sim launch "$var"/*.app
@citylims
citylims / mutation_observer.js
Created October 20, 2015 18:24
DOM Mutation Observer.
MutationObserver = window.WebKitMutationObserver;
var observer = new MutationObserver(function(mutations, observer) {
console.log(mutations, observer);
foo()
});
observer.observe(document, {
subtree: true,
childList: true,
@citylims
citylims / ghostwriter.js
Last active January 20, 2016 18:18
ghostwriter angular directive
(function() {
'use strict';
/**
* @desc directive for ghostwriter
* @example <ghost-writer></ghost-writer>
*/
angular
.module('starter')
@citylims
citylims / chrome_tabs.js
Created November 24, 2015 02:42
Semantics with google chrome api
//execute my jquery script in chrome tabs;
//execute my content script in the chorme tabs;
chrome.tabs.executeScript({ file: "jquery.min.js" }, function() {
chrome.tabs.executeScript({ file: "scripts/content.js" });
});
//when a new chrome tab is created run my function;
chrome.tabs.onCreated.addListener(function(tabId, changeInfo, tab) {
refeshScript();
});
require 'sinatra'
require 'sinatra/reloader'
require 'omniauth-twitter'
configure do
enable :sessions
user OmniAuth::Builder do
provider :twitter, ENV['CONSUMER_KEY'], ENV['CONSUMER_SECRET']
end
end