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
# model finance.rb | |
class Finance < ActiveRecord::Base | |
attr_accessible :amount, :date, :description, :type | |
belongs_to :users, :dependent => :destroy | |
end | |
# model income.rb |
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
# model finance.rb | |
class Finance < ActiveRecord::Base | |
# Attributes | |
attr_accessible :amount, :date, :description, :type | |
# Associations | |
belongs_to :users, :dependent => :destroy |
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
from django.core.management.base import BaseCommand | |
from django.conf import settings | |
import csv | |
from bah_api.models import withDependents, withOutDependents, ZipMHA | |
class Command(BaseCommand): | |
def handle(self, *args, **options): | |
# Populate CSV file into model | |
def LoadCSV(file_location, my_model, delim): | |
f = open(file_location) |
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
# read file | |
with open('names.txt') as f: | |
file_data = f.read() |
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", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"iam:GetRole", | |
"iam:PutRolePolicy" | |
], | |
"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
FROM python:2.7.14 | |
ENV PYTHONUNBUFFERED 1 | |
RUN mkdir /code | |
WORKDIR /code | |
ADD . /code/ | |
ADD requirements /requirements | |
RUN pip install -r /requirements/local.txt |
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
from decimal import Decimal | |
from django_elasticsearch_dsl import DocType, Index, fields | |
from record.templatetags.record_tags import currency | |
from .models import Employee, Jurisdiction | |
# Name of the Elasticsearch index | |
employee = Index('employees') | |
# See Elasticsearch Indices API reference for available settings | |
employee.settings( | |
number_of_shards=1, |
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
from flask import Flask | |
from flask_marshmallow import Marshmallow | |
from flask_sqlalchemy import SQLAlchemy | |
from models import Magazine | |
from utils import build_link_header, validate_per_page | |
app = Flask(__name__) | |
db = SQLAlchemy(app) | |
ma = Marshmallow(app) |
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 requests | |
from iso3166 import countries | |
GLOBAL_SOUTH_COUNTRIES = [ | |
# source https://meta.wikimedia.org/wiki/List_of_countries_by_regional_classification | |
"Afghanistan", | |
"Algeria", | |
"American Samoa", | |
"Angola", | |
"Anguilla", |
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 requests | |
def get_citation_counts(): | |
# sample author | |
author_id = "https://openalex.org/A2151238091" | |
# get up to 50 works for this author | |
r2 = requests.get( | |
f"https://api.openalex.org/works?filter=authorships.author.id:{author_id}" |
OlderNewer