Skip to content

Instantly share code, notes, and snippets.

@ashlynnpai
ashlynnpai / script.js
Created September 18, 2017 16:16
call to Twitch API
function getFeed() {
$.getJSON('https://wind-bow.glitch.me/twitch-api/streams/freecodecamp?callback=?', function(data) {
var isStreaming = document.getElementById("report");
if (data.stream == null) {
isStreaming.innerHTML = "Down"
}
else {
var a = document.createElement("a");
var streamStatus = document.createTextNode("Up");
a.appendChild(streamStatus);
@ashlynnpai
ashlynnpai / index.html
Created September 14, 2017 14:55
Wikipedia API viewer
<body>
<input id="startSearch" type="text">
<button onClick="getEntries()">Search Wikipedia</button>
<div>
<button onClick="getRandom()">Get Random Entry</button>
</div>
<div id="showResults">
</div>
</body>
//Mozilla documentation for geolocation
function getWeather() {
var output = document.getElementById("out");
var picture = document.getElementById("icon");
if (!navigator.geolocation){
output.innerHTML = "<p>Geolocation is not supported by your browser</p>";
return;
}
function success(position) {
@ashlynnpai
ashlynnpai / index.html
Created August 8, 2017 15:26 — forked from anonymous/index.html
Quotes
<body>
<button id="getQuote">Get a Quote
</button>
<h1 id="quote-content">
</h1>
<h2 id="quote-title">
</h2>
<button id="btnTweet">Tweet This</button>
</body>
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
def print_values(list_node)
if list_node
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
def print_values(list_node)
if list_node
require "geocoder"
list = [[38.0813888889,46.2930555556,0,1,1346,"Tabriz Historic Bazaar Complex"]]
def get_coordinates(list)
all_places = []
list.each do |row|
place = []
name = row[5]
class Deck
attr_accessor :cards
def initialize(cards)
@cards = cards
suit = ['C', 'D', 'H', 'S']
rank = [*2..10, 'J', 'Q', 'K', 'A']
@cards = suit.product(rank).map(&:join)
end

Astronomical clock

My clock is based on the Astronomical Clock in Prague.

Outer ring -- This is an approximation of old Czech time and show the hours until sunset, with the golden number 24 marking the time of sunset.

Main ring -- This shows the hour according to astronomical time, with noon at 0 degrees. The golden hand points to the current hour.

Hubble Telescope Orbits Earth

Uses CSS3.

The earth photo GPN-2000-001097 and Hubble 1990-037B are property of NASA and are in the public domain.

A Pen by Ashlynn Pai on CodePen.

License.