Skip to content

Instantly share code, notes, and snippets.

😇
I'm Innocent

Innocent Udeogu Innarticles

😇
I'm Innocent
Block or report user

Report or block Innarticles

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Rails Technical Challenge API.md

Challenge Specs:

Using Ruby on Rails we would like you to create a simple blog api-only application. The application should fulfill the requirements below. Any one can create a blog with or without a loggedin account.

  • You can only comment as a authenticated user (logged in).
  • You can not commment on more than 2 blogs in a given day 24 hours period.
  • Your api must be in line with JsonAPI standards.
  • The source code must be placed in a public repo on GitHub.
  • The application should be deployable on Heroku.
View Vim Usage Cheatsheet.txt
h moves the cursor one character to the left.
j moves the cursor down one line.
k moves the cursor up one line.
l moves the cursor one character to the right.
0 moves the cursor to the beginning of the line.
$ moves the cursor to the end of the line.
w move forward one word.
b move backwards one word.
G move to the end of the file.
gg move to the beginning of the file.
View get_responses.rb
max = 0.0
if !QaCorp.where("question like ?", "%#{self.text}%").empty?
# Exact question exist in the database.
answer = QaCorp.where("question like ?", "%#{self.text}%").first.answer
max = 1.0
else
corpus = QaCorp.all.map {|qa| TfIdfSimilarity::Document.new(qa.question)}
d_question = TfIdfSimilarity::Document.new(self.text)
corpus << d_question
model = TfIdfSimilarity::TfIdfModel.new(corpus, :library => :nmatrix)
@Innarticles
Innarticles / combine_csvs.py
Created Aug 25, 2018
Combine data from several csv files
View combine_csvs.py
import glob
import pandas as pd
path ='/' # use your path
allFiles = glob.glob("*.csv")
frame = pd.DataFrame()
list_ = []
for file_ in allFiles:
df = pd.read_csv(file_,index_col=None, header=None)
list_.append(df)
View integrityng.py
url = "http://integrity.ng/index.php/units/browse"
from bs4 import BeautifulSoup
import requests
import csv
# Main Coding Sectio
start = 1
with open("Units.csv", 'wb') as save:
while True:
try:
@Innarticles
Innarticles / CSV_DB.rb
Created Jul 22, 2018
Rails Code Snippet on Creating Objects from CSV data
View CSV_DB.rb
csv_text = File.read(Rails.root.join('lib', 'seeds', 'products.csv'))
csv = CSV.parse(csv_text, :headers => true, :encoding => 'ISO-8859-1')
csv.each do |row|
t = Product.new
t.id = row['id']
t.title = row['title']
t.brand = row['brand']
t.description = row['description']
t.main_image = row['picture']
t.condition = row['condition']
View Nigeria_States.js
var state_arr = new Array("Lagos", "Rivers", "FCT", "Abia", "Adamawa", "Akwa Ibom", "Anambra", "Bauchi", "Bayelsa",
"Benue", "Borno", "Cross River", "Delta","Ebonyi", "Edo", "Ekiti", "Enugu", "Gombe", "Imo", "Jigawa", "Kaduna", "Kano","Katsina", "Kebbi", "Kogi", "Kwara", "Nasarawa", "Niger", "Ogun", "Ondo", "Osun", "Oyo", "Plateau", "Sokoto", "Taraba", "Yobe", "Zamfara");
@Innarticles
Innarticles / flaskapp.py
Last active Feb 13, 2017
Flask code for Fashion Recognizer
View flaskapp.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import re
import sys
import tarfile
import numpy as np
@Innarticles
Innarticles / install-tensorflow.sh
Created Jan 14, 2017 — forked from erikbern/install-tensorflow.sh
Installing TensorFlow on EC2
View install-tensorflow.sh
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
View gist:db5f33480d74f5fecc30cedcf613d5f0
You can’t perform that action at this time.