Skip to content

Instantly share code, notes, and snippets.

View Shaddyjr's full-sized avatar
📉
You must construct additional models

Mahdi Shadkam-Farrokhi Shaddyjr

📉
You must construct additional models
View GitHub Profile
@Shaddyjr
Shaddyjr / script.js
Created June 18, 2018 15:32
Debugging Code Along
const x = 5;
x = 4;
console.log("Did you know? " + GodsOfDeathLoveApples);
@Shaddyjr
Shaddyjr / README.md
Created June 18, 2018 17:02
Saving your work: Code Along

All Secrets

@Shaddyjr
Shaddyjr / pokemon.json
Last active August 7, 2023 17:52
Code Along: JSON
{
"base": {
"Attack": 49,
"Defense": 49,
"HP": 45,
"Sp.Atk": 65,
"Sp.Def": 65,
"Speed": 45
},
"name": "Bulbasaur",
def dirReduc(arr):
directions = {
"NORTH" : "SOUTH" ,
"SOUTH" : "NORTH" ,
"WEST" : "EAST" ,
"EAST" : "WEST"
}
for i in range(len(arr)-1):
move = arr[i]
# Quick test for skipping index within loop
nums = [1,2,3,4,5,6,7,8,9,10]
for i in range(len(nums)):
print(i)
num = nums[i]
if(num % 2 == 0):
i += 5
# Doh! prints 0-9
def dirReduc(arr):
directions = {
"NORTH" : "SOUTH" ,
"SOUTH" : "NORTH" ,
"WEST" : "EAST" ,
"EAST" : "WEST"
}
output = []
i = 0
while(i < len(arr)-1):
def dirReduc(arr):
if(len(arr) <= 1): # short circuit
return arr
directions = {
"NORTH" : "SOUTH" ,
"SOUTH" : "NORTH" ,
"WEST" : "EAST" ,
"EAST" : "WEST"
}
# All credit to the following users on Code Wars:
# aenik97, CSNqwer, kickh, joei26, suhlob
opposite = {'NORTH': 'SOUTH', 'EAST': 'WEST', 'SOUTH': 'NORTH', 'WEST': 'EAST'}
def dirReduc(plan):
new_plan = []
for d in plan:
if new_plan and new_plan[-1] == opposite[d]:
new_plan.pop()
else:
SELECT *
FROM actor AS a
INNER JOIN film_actor AS fa ON a.actor_id = fa.actor_id
INNER JOIN film AS f on f.film_id = fa.film_id
-- https://stackoverflow.com/questions/11056235/finding-rows-with-same-values-in-multiple-columns
SELECT A.*
FROM YourTable A
INNER JOIN (SELECT Address, State
FROM YourTable
GROUP BY Address, State
HAVING COUNT(*) > 1) B
ON A.Address = B.Address AND A.State = B.State