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
while line = gets | |
line.gsub! /([\.\?!]+)/, ' entre mis piernas\1' | |
puts line | |
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
substitute(_, _, [], []). | |
substitute(This, ForThis, [This | List], [ForThis | Result]) :- substitute(This, ForThis, List, Result). | |
substitute(This, ForThis, [Other | List], [Other | Result]) :- substitute(This, ForThis, List, Result). |
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
euclid(A, 0, Z) :- Z is A. | |
euclid(A, B, Z) :- B > A, euclid(B, A, Z). | |
euclid(A, B, Z) :- X is A mod B, euclid(B, X, Z). | |
gcd(A, B, Z) :- euclid(A, B, Z). |
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
ancestor(A, B) :- parent(A, B). | |
ancestor(A, B) :- parent(X, B), ancestor(A, X). | |
lca(A, B, X) :- ancestor(X, A), ancestor(X, 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
# have all your forms extend this mixin | |
class NoLabelSuffixMixin: | |
def __init__(self, *args, **kwargs): | |
if 'label_suffix' not in kwargs: | |
kwargs['label_suffix'] = '' | |
super(NoLabelSuffixMixin, self).__init__(*args, **kwargs) |
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
@echo off | |
start "sublime" /b "%ProgramFiles%\Sublime Text 3\sublime_text.exe" %* |
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 random | |
random.seed() | |
defeat = {'rock': 'scissor', 'paper': 'rock', 'scissor': 'paper'} | |
def ask_user(): | |
while True: | |
user_choice = input('Say: ') |
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
#include <stdio.h> | |
#define palsize 100 | |
/* | |
* Returns 1 if is a pure palindrome. | |
* The name is a bit mangled up because good C code shouldn't be understandable. | |
*/ | |
int ispaldrm(char* s) | |
{ |
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 locale | |
from math import factorial as f | |
locale.setlocale(locale.LC_ALL, 'en') | |
nice = lambda: locale.format("%d", _, grouping=True) |
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 lcs(s, t): | |
if not s or not t: | |
return '' | |
if s[0] is t[0]: | |
return s[0] + lcs(s[1:], t[1:]) | |
result1 = lcs(s[1:], t) | |
result2 = lcs(s, t[1:]) | |
if len(result1) > len(result2): | |
return result1 | |
else: |
OlderNewer