Skip to content

Instantly share code, notes, and snippets.

View notblizzard's full-sized avatar
❄️
arctic fox

Blizzard notblizzard

❄️
arctic fox
  • Kentucky
  • 11:48 (UTC -04:00)
View GitHub Profile
#---------------------
#def capalize(word): -
# a = word[0:1] -
# a = a.upper -
# b = word[1:] -
# word = a + b -
# return word -
# -
#print caplize(hello)-
#---------------------
# pythagorean theorem
from math import sqrt
def pory(a,b,c):
asquare = a*a
bsquare = b*b
c = asquare + bsquare
c = sqrt(c)
print "Solving the Pythagorean Theorem for "+a+" and "+b+" is "+c+""
def fahrenheit_to_celsius(a):
new_temp = (a - 32) * 5/9
new_temp = float(new_temp)
print "{0} Fahrenheit converted to Celsius is {1}.".format(a, new_temp)
def celsius_to_fahrenheit(a):
new_temp = a * 9/5 + 32
new_temp = float(new_temp)
print "{0} Celsius converted to Fahrenheit is {1}.".format(a, new_temp)
@notblizzard
notblizzard / trianglefinder.py
Last active August 29, 2015 13:55
A way to find the missing side of a triangle.
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)
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!");
package main
import "fmt"
func main() {
fmt.println("Hello, World.")
}
def authenticate
authenticate_or_request_with_http_basic do |user, pass|
Admin.find_by(user: user).try(:authenticate, pass)
end
end
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
let 2+2=5 in 2+2
--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