Skip to content

Instantly share code, notes, and snippets.

View nikasulo's full-sized avatar
🚀
Working Remotely

Nikasulo nikasulo

🚀
Working Remotely
View GitHub Profile
def display_billable_hours(entries)
entries.each do |key, value|
puts "#{key}:"
puts value
end
end
def handle_input
days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
entries = {}

Keybase proof

I hereby claim:

  • I am oluwadamilareolusakin on github.
  • I am oluwadamilareo (https://keybase.io/oluwadamilareo) on keybase.
  • I have a public key ASAvLpR6y_qF-bWVGQOcxJUkonZr9xw171j22yKV5oPLDQo

To claim this, I am signing this object:

@nikasulo
nikasulo / TestSolution.js
Created June 3, 2020 16:42
The solution to my test
function assertEquals(result, expected) {
if (result !== expected) {
throw new Error(`result: ${result} expected: ${expected}`);
}
}
// No validations needed
// Assume that the string is composed only by (positive) numbers
// NOTE: cannot use parseInt and Number constructor
function parseCoolInteger(value) {
@nikasulo
nikasulo / Upwork Test
Last active May 6, 2020 17:53
Test Answers
# More elegant
def alphabet_position(string)
string_codes = string.downcase.bytes.to_a
strictly_alphabets = []
string_codes.each do |code|
unless code - 96 < 1 || code - 96 > 26
strictly_alphabets << code - 96
end
end
@nikasulo
nikasulo / api.js
Last active February 27, 2020 02:21
import axios from 'axios';
export default axios.create({
baseURL: `https://oluwadamilare-api.herokuapp.com`,
});
export const APIHelpers = {
authorizationHeaders: (auth_token) => (
{
Authorization: auth_token,
export const uploadToAWS = async(auth_token, file, directory) => {
const { data } = await API.get("/upload", {params: {filename: file.name, fileType: file.type, directory: directory}, headers: APIHelpers.authorizationHeaders(auth_token)});
const { post_url, get_url } = data;
const options = {
headers: {"Content-Type": file.type,'acl': 'public-read'},
}
await axios.put(post_url, file, options)
return get_url;
}
handleChange(e) {
const { target } = e;
if (target.id === "image") {
this.setState({image: e.target.files[0]});
return;
}
const value = target.value;
this.setState({[e.target.id]: value})
<input onChange={this.handleChange} type="file" id="image" />
def json_response(object, status = :ok)
render json: object, status: status
end
class S3UploadsController < ApplicationController
def set_s3_direct_post
filename = params[:filename]
file_type = params[:fileType]
directory = params[:directory]
random_path = SecureRandom.uuid
key = "uploads/#{directory}/#{random_path}/#{filename}"
signer = Aws::S3::Presigner.new
post_url = signer.presigned_url(:put_object, bucket: "damilare-api", key: key, acl: 'public-read', content_type: file_type)