Skip to content

Instantly share code, notes, and snippets.

View PlenipotentSS's full-sized avatar

Steven Stevenson PlenipotentSS

View GitHub Profile
@PlenipotentSS
PlenipotentSS / gist:af76a0879fcb9e1a522c
Created June 4, 2014 23:58
Guessing Game with Loop
<script>
var guess, answer, difference
var answer = 411
for (i=0; i<10; i++) {
guess = prompt("How many licks does it take to get to the Tootsie Roll center of a Tootsie Pop?","Enter answer here");
if (guess == 411) {
alert("Congrats, You win life time supply of Tootsie Rolls!")
break;
// NESTED FOR LOOP:
for(var i=0;i<3;i++) { //declare i=0; stop if i >=3; increase i by 1 after each run
for (var j=0;j<2;j++) { //declare j=0; stop if j>=2; increase j by 1 after each run
console.log(i+" "+j) //prints i and j for each iteration
}
}
//this should returns:
//
@PlenipotentSS
PlenipotentSS / gist:1cfa870085113eececc7
Created June 9, 2014 21:28
Code Roulette adjusment
<script>
var codeRoulette = function() {
var guess, answer;
guess = prompt("Welcome to Code Roulette. Please guess the number I am thinking of between 0 and 10. You have 3 chances to guess the correct number or you die.");
answer=Math.floor(Math.random()*11);
if(guess == answer) {
return"That is correct. Congratulations. You win $1 million.";
}
<script>
var feet, result, var tries;
var findDifference = function(answer, guess) {
if (answer > guess) {
return answer - guess;
}
else {
return guess-answer;
}
}
<script>
var debug = false
var counter, openPile;
//NEED WELCOME/INTRO
//create class of cards
function Card(rank, suit) {
this.rank = rank;
this.suit = suit;
<script>
var owl, cat, whowins, winner;
whowins= prompt("Guess who will the tootsie pop contest, Owl or Cat?");
function Animal(name, speed, focus){
this.name= name;
this.speed=speed;
this.position=0;
this.focus= focus;
this.run= function(){
if(Math.random() *10 < this.focus) {
@PlenipotentSS
PlenipotentSS / hammie.scss
Last active August 29, 2015 14:17
Hammie SCSS
// mobile navigation icon
// using bourbon library
.hammie {
.has-universe & {
top: $universeBarHeight+45+px;
}
display: none;
vertical-align: middle;
@PlenipotentSS
PlenipotentSS / hammie.js
Last active August 29, 2015 14:17
Hammie JS
var $win, $doc,
$body = $('body'),
$main = $('main'),
$hammie = $('.hammie');
var toggleMobileMenu = function() {
if ($body.hasClass('is-active')) {
$mobileDrawer.animate({
height: 0
<div id="fb-root"></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=543069402473732"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<script type="text/javascript">(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/platform.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script>
<script type="text/javascript">(function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT'
@PlenipotentSS
PlenipotentSS / mixin.scss
Created April 7, 2015 18:57
SCSS fancy underline mixin
@mixin fancy-underline( $regColor:transparent, $hoverColor:#ffffff, $size: 1.5px, $distance: 4px, $delay: false) {
@include transition(padding .2s ease-in-out);
@if $delay {
@include transition-delay(.2s);
}
border-bottom: $size solid transparent;
color: $regColor;
display: inline-block;
text-decoration: none;