This file contains hidden or 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 reverse(s): | |
return s[::-1] |
This file contains hidden or 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 fib_r(n) | |
if(n <= 1) | |
return 1 | |
else | |
return fib(n-1) + fib(n-2) | |
end | |
end |
This file contains hidden or 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 fib_i(n) | |
result = p1 = p2 = 1; | |
if(n > 1) | |
for i in 1..n | |
result = p1 + p2 | |
p2 = p1 | |
p1 = result | |
end | |
end | |
return result |
This file contains hidden or 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
#include <stdio.h> | |
void print_s(const char * s) { | |
if(*s != 0) { | |
putchar(*s); | |
print_s(s+1); | |
} | |
} | |
int main() { |
This file contains hidden or 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
#include <stdio.h> | |
void print_s_r(const char * s) { | |
if(*s != 0) { | |
print_s_r(s+1); | |
putchar(*s); | |
} | |
} | |
int main() { |
This file contains hidden or 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
pid = fork{ exec 'afplay', "song.mp3" } # on mac osx |
This file contains hidden or 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
/** | |
* "LinkEntry" class. | |
* This is an entry (or node) for a linked list containing an | |
* object of type E as the entry's data. | |
* @author Ryan Seys | |
* | |
* @param <E> the type of element which makes up the link entry. | |
*/ | |
public class LinkEntry<E> { | |
protected E element; // The entry's data. |
This file contains hidden or 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
(* This is a script made by Ryan Seys to remove the excess strings from lyrics that are inserted and generated from the application "Get Lyrical". It properly removes the Title and Artist from the start of the Lyrics, and the text "branding" that Get Lyrical inserts to all the lyrics it fetches. Usage: Select the songs that you would like to clean in iTunes, then run the script.*) | |
on trim_line(this_text, trim_chars, trim_indicator) | |
-- 0 = beginning, 1 = end, 2 = both | |
set x to the length of the trim_chars | |
-- TRIM BEGINNING | |
if the trim_indicator is in {0, 2} then | |
repeat while this_text begins with the trim_chars | |
try | |
set this_text to characters (x + 1) thru -1 of this_text as string |
This file contains hidden or 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
# This Python application will calculate the passer rating | |
# (passer efficiency or pass efficiency) given the five required variables. | |
# | |
# Variables to be used as values are defined below. Set to strings so input | |
# can be anything. Later the strings will be converted to numbers, given | |
# they pass a series of error checking tests. | |
COMP = "null" | |
ATT = "null" | |
YARDS = "null" |
This file contains hidden or 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
function fac_rec(n) { | |
if(n <= 1) return 1; | |
else return n * fac_rec(n-1); | |
} |
OlderNewer