Skip to content

Instantly share code, notes, and snippets.

Jasmine F dubistdu

Block or report user

Report or block dubistdu

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
@dubistdu
dubistdu / perimeter_of_squares_in_a_rectangle.md
Last active May 8, 2019
perimeter_of_squares_in_a_rectangle
View perimeter_of_squares_in_a_rectangle.md

ruby

def perimeter(n)
  num = [0,1]
  i = 0
  until i == n do
    num << num[i] + num [i+1]
    i += 1
  end
View soduku.md
def validSolution(board)
  return false if board.flatten.include?(0)
  board.map {|a| a.uniq.count == 9}.include?(false) ? false : board
  square_of_3 = board.map { |a| a.each_slice(3).to_a }
  s1=square_of_3[0][0].zip(square_of_3[1][0],square_of_3[2][0])
  s2=square_of_3[0][1].zip(square_of_3[1][1],square_of_3[2][1])
  s3=square_of_3[0][2].zip(square_of_3[1][2],square_of_3[2][2])
  
  s4=square_of_3[3][0].zip(square_of_3[4][0],square_of_3[5][0])
View gist:d64f8a4c560e8507dfd0efd234cbc373

*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

@dubistdu
dubistdu / terminal_flicker.md
Last active Oct 4, 2018
Troubleshoot - Terminal Gone!
View terminal_flicker.md

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 / git commands.md
Last active Sep 29, 2018 — forked from scootcho/git commands.md
git commands #git #commands
View git commands.md

initialize git depository in the current directory

git init .

display the git remote/origin

cat .git/config
@dubistdu
dubistdu / RAILS_5_CHEATSHEET.md
Created Sep 17, 2018 — forked from harrietty/RAILS_5_CHEATSHEET.md
Ruby on Rails 5 Cheatsheet
View RAILS_5_CHEATSHEET.md

Ruby on Rails Cheatsheet (5.1)

Architecture

RVM

$ rvm list - show currently installed Rubies

@dubistdu
dubistdu / temp.md
Created Apr 16, 2018
consonant kata / form the minimum kata
View temp.md

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

View Selenium Cheat Sheet.md

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
View selenium-webdriver-cheatsheet.md

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 / create_phone.txt
Last active Mar 31, 2018
create phone number
View create_phone.txt
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
You can’t perform that action at this time.