Skip to content

Instantly share code, notes, and snippets.

View dubistdu's full-sized avatar

Jasmine F dubistdu

  • FL
View GitHub Profile
@dubistdu
dubistdu / http_basic.md
Last active February 22, 2018 14:20
HTTP Basics

HTTP

HTTP is a protocol which allows the fetching of resources, such as HTML documents. It is the foundation of any data exchange on the Web and a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance text, layout description, images, videos, scripts, and more. It functions mainly as a request-response cycle between a client and a server. A client makes a request and a server responds. HTTP is a plain text protocol, which means that messages sent using HTTP. HTTP itself is a stateless protocol. There's no record of previous interactions, and each interaction is processed with only with the information that comes with that particular interaction.

HTTP (note: no "s" on the end) data is not encrypted, and it can be intercepted by third parties to gather data being passed between the two systems.

@dubistdu
dubistdu / simple_fun.txt
Last active March 20, 2018 18:57
Code war simple fun #165
n [100a, 50a, 20a]
50 [0,1,0], 70 [0,1,1], 90 [0,1,2], 110 [0,1,3], 130 [0,1,4], 210 [1,1,3], 230[1,1,4], 250 [2,1.0]
if n%20 == 10 [?, 1, ?]
Integer rounds up decimal places to floor
Use integer so I don't have to worry about cases like 1.7. \n
For example, (1.0 - 1.9) all equals to 1
Number of $100 bills
subtract 50 from total first since 1 $50 will always be there. 50 does not ever get used more than once
divide n-50 by 100 and you will get # of 100 bills
Number of $20s
@dubistdu
dubistdu / create_phone.txt
Last active March 31, 2018 00:08
create phone number
def createPhoneNumber(array)
'(%d%d%d) %d%d%d-%d%d%d%d' % array
end
https://ruby-doc.org/core-2.2.0/Kernel.html
array count has to match that of d
each array item replaces d in string

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@dubistdu
dubistdu / Selenium Cheat Sheet.md
Created April 4, 2018 17:56 — forked from kenrett/Selenium Cheat Sheet.md
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@dubistdu
dubistdu / temp.md
Created April 16, 2018 21:42
consonant kata / form the minimum kata

consonant

ruby

def solve(s)
  alphabet = ("a".."z").to_a
  s.tr('aeiou', "*").split("*").map { |a| a.chars.map { |i| alphabet.find_index(i) + 1 }.sum }.max
end

js

@dubistdu
dubistdu / RAILS_5_CHEATSHEET.md
Created September 17, 2018 00:32 — forked from harrietty/RAILS_5_CHEATSHEET.md
Ruby on Rails 5 Cheatsheet

Ruby on Rails Cheatsheet (5.1)

Architecture

RVM

$ rvm list - show currently installed Rubies

@dubistdu
dubistdu / git commands.md
Last active September 29, 2018 19:18 — forked from scootcho/git commands.md
git commands #git #commands

initialize git depository in the current directory

git init .

display the git remote/origin

cat .git/config
@dubistdu
dubistdu / terminal_flicker.md
Last active October 4, 2018 03:12
Troubleshoot - Terminal Gone!

Issue I had was terminal flashing and disappearing after removing Zsh while Terminal app was still running

Solution
  • Before removing shell, I should have switched to bash using chsh -s /bin/bashsince I can't uninstall zsh as I was using zsh!

    • It should have been chsh -s /bin/bash
    • to swich back to bash temporarily
    • then uninstall / reinstall zsh
    • then chsh -s /usr/local/bin/zsh to switch back to zsh
  • Since I didn't switch to bash first....

@dubistdu
dubistdu / gist:d64f8a4c560e8507dfd0efd234cbc373
Last active February 1, 2019 20:07
Multiples of 3 or 5

*JS

const solution = (number) => {
  return (number < 1 ? 0 : [...Array(number).keys()].filter(num => num % 3 == 0 || num % 5 == 0).reduce((a,b) => a+b));
}

*ruby