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
# coding=UTF-8 | |
from __future__ import division | |
import re | |
# This is a naive text summarization algorithm | |
# Created by Shlomi Babluki | |
# April, 2013 | |
class SummaryTool(object): |
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
["Life isn’t about getting and having, it’s about giving and being.", "Kevin Kruse"] | |
["Whatever the mind of man can conceive and believe, it can achieve.", "Napoleon Hill"] | |
["Strive not to be a success, but rather to be of value.", "Albert Einstein"] | |
["Two roads diverged in a wood, and I—I took the one less traveled by, And that has made all the difference.", "Robert Frost"] | |
["I attribute my success to this: I never gave or took any excuse.", "Florence Nightingale"] | |
["You miss 100% of the shots you don’t take.", "Wayne Gretzky"] | |
["I’ve missed more than 9000 shots in my career. I’ve lost almost 300 games. 26 times I’ve been trusted to take the game winning shot and missed. I’ve failed over and over and over again in my life. And that is why I succeed.", "Michael Jordan"] | |
["The most difficult thing is the decision to act, the rest is merely tenacity.", "Amelia Earhart"] | |
["Every strike brings me closer to the next home run.", "Babe Ruth"] | |
["Definiteness of purpose is the starting point of all achievement.", "W. |
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
class PostListSerializer(serializers.Serializer): | |
slug = serializers.SerializerMethodField() | |
title = serializers.SerializerMethodField() | |
excerpt = serializers.SerializerMethodField() | |
# get translation to generate slug, title and excerpt | |
translation = None | |
def get_translation(self, post): | |
self.translation = post.translations.order_by('created_at').only('title', 'content')[0] |
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
class ExampleController < ApplicationController | |
def action_1 | |
if res1.eql?(false) | |
render json: {message: 'Failed'}, status: 400 unless res_1 | |
return | |
end | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
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
class ExampleController < ApplicationController | |
def action_1 | |
end | |
def action_2 | |
end | |
def action_3 | |
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
class ExampleController < ApplicationController | |
def action_1 | |
if res1.eql?(false) | |
render json: {message: 'Failed'}, status: 400 unless res_1 | |
return | |
end | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
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
class ExampleController < ApplicationController | |
def action_1 | |
res_1; return if performed? | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_2 | |
res_1; return if performed? | |
# rest of the logic.... |
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
class ExampleController < ApplicationController | |
before_action :res1, only: [:action_1, :action_2] | |
before_action :res2, only: [:action_3, :action_4] | |
def action_1 | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_2 |
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
{ | |
"Version": "2012-10-17", | |
"Id": "Policy1593349925842", | |
"Statement": [ | |
{ | |
"Sid": "Stmt1593349907809", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:*", | |
"Resource": [ |
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
version: 0.2 | |
phases: | |
install: | |
commands: | |
- npm i npm@latest -g | |
- pip install --upgrade pip | |
- pip install --upgrade awscli | |
pre_build: | |
commands: |
OlderNewer