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 almostSorted(arr): | |
s = sorted(arr) | |
diffcount = 0 | |
diff1 = None | |
diff2 = None | |
for i in range(len(arr)): |
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
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 |
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
{% 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">«</span> | |
</a> | |
</li> |
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
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 |
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
# ----------------------------------------------------------------------- | |
# 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 |
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 resize_and_crop(img_path, modified_path, size, crop_type='top'): | |
""" | |
Resize and crop an image to fit the specified size. | |
args: | |
img_path: path for the image to resize. | |
modified_path: path to store the modified image. | |
size: `(width, height)` tuple. | |
crop_type: can be 'top', 'middle' or 'bottom', depending on this | |
value, the image will cropped getting the 'top/left', 'middle' or |
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
edis_1 | [1] 20 Dec 22:51:18.478 * Background saving started by pid 14 | |
redis_1 | [14] 20 Dec 22:51:18.562 * DB saved on disk | |
redis_1 | [14] 20 Dec 22:51:18.564 * RDB: 6 MB of memory used by copy-on-write | |
redis_1 | [1] 20 Dec 22:51:18.579 * Background saving terminated with success | |
postgres_1 | ERROR: role "catwatch" already exists | |
postgres_1 | STATEMENT: CREATE USER catwatch WITH PASSWORD 'bestpassword' | |
postgres_1 | ERROR: role "catwatch" already exists | |
postgres_1 | STATEMENT: CREATE USER catwatch WITH PASSWORD 'bestpassword' | |
redis_1 | [1] 20 Dec 23:41:20.277 * 100 changes in 300 seconds. Saving... |
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
//Función para convertir el custom_field('xx') en un excerpt de 50 palabras máximo | |
function get_athelas_custom_field_excerpt($title, $chars) { | |
global $post; | |
$text = get_field($title); | |
if ( '' != $text ) { | |
$text = strip_shortcodes( $text ); | |
$text = apply_filters('the_content', $text); | |
$text = str_replace(']]>', ']]>', $text); | |
$excerpt_length = $chars; // in words | |
$excerpt_more = apply_filters('excerpt_more', ' ' . '...'); |
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
server { | |
#listen 80; | |
index index.html index.php; | |
## Begin - Server Info | |
root /var/www/; | |
server_name grav; | |
## End - Server Info | |
## Begin - Index |
NewerOlder