This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sin, cos, tan | |
#Work on Another Day. | |
def triangle_side_finder(): | |
x = 0 | |
answer = None | |
numbers = True | |
degree = input("What is the degree of the angle?") | |
while numbers == True: | |
try: | |
degree = int(degree) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Calendar; | |
import java.util.GregorianCalendar; | |
public class day { | |
public static void main (String[] args) { | |
Calendar calendar = new GregorianCalendar(); | |
int day = calendar.get(Calendar.DAY_OF_WEEK); | |
switch (day) { | |
case 1: | |
System.out.println("It\'s Sunday!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
fmt.println("Hello, World.") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def authenticate | |
authenticate_or_request_with_http_basic do |user, pass| | |
Admin.find_by(user: user).try(:authenticate, pass) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
admin = Admin.find_by(user: params[:user]) | |
if admin && admin.authenticate(params[:password]) != false | |
login admin | |
redirect_to root_path | |
else | |
redirect_to blog_index_path | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let 2+2=5 in 2+2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--not mine, from http://www.codewars.com/kata/hamming-distance/solutions?show-solutions=1 by mtthw123 | |
module Hamming where | |
hamming :: String -> String -> Int | |
hamming a b = length . filter id $ zipWith (/=) a b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func viewHandler(w http.ResponseWriter, r *http.Request) { | |
title := r.URL.Path[len("/view/"):] | |
p, _ := loadPage(title) | |
t, _ := template.ParseFiles("view.html") | |
t.Execute(w, p) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(('a'..'z').to_a - 'hello'.chars.to_a).empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import * | |
import time | |
import sys | |
while True: | |
date = datetime.now().strftime("%H:%M:%S") | |
sys.stdout.write(str(date)+'\r') | |
sys.stdout.flush() | |
time.sleep(1) |
OlderNewer