Skip to content

Instantly share code, notes, and snippets.

View tparveen's full-sized avatar

Tauhida Parveen tparveen

View GitHub Profile
  1. What are the three longest trips on rainy days?
WITH rainy as 
(
SELECT 
DATE(date) rain_date
From weather
WHERE events = 'Rain'
GROUP BY 1
) 
@tparveen
tparveen / fizzbuzzReturns.js
Created June 15, 2018 12:33
Fizzbuzz with modularization
const fizzbuzz = function(num){
if(num%15 === 0){
return 'fizzbuzz';
}
if(num%5 === 0){
return 'buzz';
}
if(num%3===0){
return 'fizz';
}
@tparveen
tparveen / W1D3-stuff.js
Last active June 13, 2018 18:25
Class demo for 'this' and inheritance
const littleYacht1 = {
hornSound: "Ride of the Walkeries",
playHorn: function() {
console.log(this.hornSound);
}
};
littleYacht1.playHorn();
const biggerYacht = {
@tparveen
tparveen / crackingTheCode.js
Created June 12, 2018 18:17
W1-D2-Cracking the Code review
/*
https://github.com/rich-at-thinkful/ft-curric-gists/blob/master/fundamentals/function-drills-2.md#cracking-the-code)
A code has been invented which replaces each character in a sentence with a
five letter word. The first letter of each encoded word determines which of the remaining
four characters contains the decoded character according to this table:
First letter Character number
a 2
b 3
@tparveen
tparveen / cicd.md
Created February 24, 2018 23:18 — forked from cklanac/cicd-config-clicker.md
CICD Travis CI and Heroku: (CLI-only and normal versions)

CICD Travis and Heroku

Setup Continuous Integration with Travis CI

Install Travis CLI

Install Travis CI's CLI:

Exercises

Palindromes

A palindrome is a word, phrase, or number that is spelled the same forward and backward. For example, “dad” is a palindrome; “A man, a plan, a canal: Panama” is a palindrome if you take out the spaces and ignore the punctuation; and 1,001 is a numeric palindrome. We can use a stack to determine whether or not a given string is a palindrome.

Write a function that takes a string of letters and returns true or false to determine whether it is palindromic. For example:

function is_palindrome(s) {
 s = s.toLowerCase().replace(/[^a-zA-Z0-9]/g, "");
/*
### 1. URLify a string
A common mistake users make when they type in an URL is to put spaces between words or letters. One solution that developers can use to solve this problem is to replace any spaces with a '%20'. Write a method that takes in a string and replaces all its empty spaces with a '%20'. Your algorithm can only make 1 pass through the string.
Examples of input and output for this problem can be
Input: tauhida parveen
Output: tauhida%20parveen
input: www.thinkful.com /tauh ida parv een

IMPORTANT: Do NOT complete drills inside the Repl.IT or JSBin examples. All drills should be completed per the Working on Drills requirements https://gist.github.com/rich-at-thinkful/a36c50bc86afc31fed4113c8f1ece110 in your local environment

String, number, and logic drills

Jedi name

Write a function called jediName which takes two arguments:

  • firstName - a person's first name
  • lastName - a person's last name

Two of the most commonly used data structures in web development are stacks and queues. The history of pages visited in a web browser and the undo operation in a text editor are examples of operations made possible using stacks. The handling of events in web browsers often uses a queue data structure.

Stack

A stack is a data structure that stores elements in a LIFO (Last In First Out) order. It's like a stack of plates in your kitchen. When a plate is added, it is pushed towards the bottom of a stack. The last plate that you stack becomes the one on the top of the stack and it is the first one that you get to use.

A stack has two basic functions:

  • push(): places data onto the top of a stack
  • pop(): removes data from the top of the stack

Stack and Queue Exercises

Palindromes

A palindrome is a word, phrase, or number that is spelled the same forward and backward. For example, “dad” is a palindrome; “A man, a plan, a canal: Panama” is a palindrome if you take out the spaces and ignore the punctuation; and 1,001 is a numeric palindrome. We can use a stack to determine whether or not a given string is a palindrome.

Write a function that takes a string of letters and returns true or false to determine whether it is palindromic. For example:

function is_palindrome(s) {
    s = s.toLowerCase().replace(/[^a-z]/g, "");
 // your code goes here