Skip to content

Instantly share code, notes, and snippets.

View ondoheer's full-sized avatar

Pedro Baumann ondoheer

  • Athelas Perú
  • Lima - Perú
View GitHub Profile
# -----------------------------------------------------------------------
# Defining MIME types to ensure the web server actually knows about them.
# -----------------------------------------------------------------------
<IfModule mod_mime.c>
AddType application/javascript js
AddType application/vnd.ms-fontobject eot
AddType application/font-woff2 woff2
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
@ondoheer
ondoheer / views.py
Created April 20, 2016 16:55
Basic Flask Crud
class AdminFAQView(AdminView):
def __init__(self):
self.form = FAQQuestionForm()
self.questions = db.session.query(Question.id, Question.question).all()
def get(self, question_id=None):
form = self.form
questions = self.questions
@ondoheer
ondoheer / Pagination.html
Created July 17, 2016 15:16
Pagination with parameters
{% macro render_pagination(pagination, endpoint, per_page, order_by, direction) %}
<ul class="pagination">
{% if pagination.has_prev %}
<li>
<a href="{{ url_for(endpoint, page=pagination.prev_num, per_page=per_page, order_by=order_by, direction=direction) }}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
@ondoheer
ondoheer / game.py
Created August 22, 2017 14:24
Valentin first refactoring
stumble_around = "You stumble around and fall in a knife. Good job!"
def start_room():
print "You enter a dark room with two doors. Do you go through door #1 or #2?"
door = raw_input("> ")
if door == "1":
bear_room()
elif door == "2":
pit_fall()
else:
print stumble_around
@ondoheer
ondoheer / share.php
Created February 20, 2018 17:14
Social share links
<section class="article-footer-section article-recommend" id=" article-recommend">
<h4 class="recommend-title article-footer-section-title">Recomienda este artículo</h4><ul class="recommend-list">
<!-- TWITTER as data attributes-->
<li class="recommend-list-item" title="Comparte en Twitter">
<a href="http://twitter.com/share" data-count="none" data-url="<?php the_permalink();?>" data-text="<?php the_title(); ?>" target="_blank">
<div alt="f202" class="genericon genericon-twitter"></div>
</a>
</li>
<!-- TWITTER as uri-->
<li class="recommend-list-item" title="Comparte en Twitter">
@ondoheer
ondoheer / almost_sorted.py
Created November 7, 2019 17:49
Talently HR 1st problems
def almostSorted(arr):
s = sorted(arr)
diffcount = 0
diff1 = None
diff2 = None
for i in range(len(arr)):