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 { Component } from '@angular/core'; | |
@Component({ | |
selector: 'income-query', | |
template: ` | |
<div class='income-query'> | |
<input #income_input type='text' value='{{income}}' class='income-box'/> | |
<img (click)='breakup(income_input)' class='arrow-right' src='/resources/arrow-right.png'/> | |
</div> | |
`, |
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 random import randint | |
TRAIN_SET_LIMIT = 1000 | |
TRAIN_SET_COUNT = 100 | |
TRAIN_INPUT = list() | |
TRAIN_OUTPUT = list() | |
for i in range(TRAIN_SET_COUNT): | |
a = randint(0, TRAIN_SET_LIMIT) | |
b = randint(0, TRAIN_SET_LIMIT) | |
c = randint(0, TRAIN_SET_LIMIT) |
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 sklearn.linear_model import LinearRegression | |
predictor = LinearRegression(n_jobs=-1) | |
predictor.fit(X=TRAIN_INPUT, y=TRAIN_OUTPUT) |
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
X_TEST = [[10, 20, 30]] | |
outcome = predictor.predict(X=X_TEST) | |
coefficients = predictor.coef_ | |
print('Outcome : {}\nCoefficients : {}'.format(outcome, coefficients)) |
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
cred_file = open('credentials.json', 'r') | |
cred_json = json.load(cred_file) | |
cred_file.close() | |
public_key = cred_json['public_key'] | |
secret_key = cred_json['secret_key'] | |
upwork_client = upwork.Client(public_key, secret_key) |
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
auth_url = upwork_client.auth.get_authorize_url() | |
# Opens a new tab in default web browser | |
webbrowser.open(url=auth_url, autoraise=True, new=2) | |
print 'Go to the mentioned URL : {}'.format(auth_url) |
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
verifier = raw_input('Enter Verifier: ') | |
(token, token_secret) = upwork_client.auth.get_access_token(verifier) | |
upwork_client = upwork.Client( | |
public_key, secret_key, | |
oauth_access_token=token, | |
oauth_access_token_secret=token_secret) |
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 True: | |
# Get all latest jobs | |
print '\nGetting Jobs at {} ...\n'.format( | |
datetime.now().strftime('%H:%M')) | |
jobs = client.provider_v2.search_jobs(job_query) | |
current_jobs = set() | |
# Iterate every job | |
for job in jobs: |
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 pandas as pd | |
from sklearn.tree import DecisionTreeClassifier | |
train_data = pd.read_csv('train.csv') | |
test_data = pd.read_csv('train.csv') | |
survived = train_data['Survived'] | |
train_data.drop('Survived', axis=1, inplace=True) | |
model = DecisionTreeClassifier() |
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 index | |
@articles = Article.all.to_json( | |
:only => [:id, :title, :status, :author] | |
) | |
end | |
def publish | |
article = Article.find(params[:id]) | |
article.publish | |
render json: { |
OlderNewer