Skip to content

Instantly share code, notes, and snippets.

View cristiana214's full-sized avatar
:octocat:
Building something

Cristiana Chavez cristiana214

:octocat:
Building something
View GitHub Profile
@cristiana214
cristiana214 / coding-best-practices.md
Last active May 22, 2024 07:50
Coding Best Practices

The principles of good programming are connected to good design and engineering principles.

These programming principles have improved my skills as a programmer, and I believe they can do the same for any developer. They help increase efficiency, make code easier to maintain, and reduce the number of bugs.

Write code for maintainers please

Write code for the maintainer When you're writing code, always keep in mind that it will need to be maintained in the future, either the future you or someone else. You might not remember everything about the code in the future, just like someone else who didn't write it. So, always write your code in a way that makes it easy for others to understand and maintain.

from knn_from_scratch import knn, euclidean_distance
def recommend_movies(movie_query, k_recommendations):
raw_movies_data = []
with open('movies_recommendation_data.csv', 'r') as md:
# Discard the first line (headings)
next(md)
# Read the data into memory
for line in md.readlines():
from collections import Counter
import math
def knn(data, query, k, distance_fn, choice_fn):
neighbor_distances_and_indices = []
# 3. For each example in the data
for index, example in enumerate(data):
# 3.1 Calculate the distance between the query example and the current
# example from the data.
@dreamsparkx
dreamsparkx / More-links.txt
Last active July 22, 2024 17:46
Install Apache, PHP, MySQL and phpMyAdmin on Mac OS X
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active July 23, 2024 07:29
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@parmentf
parmentf / GitCommitEmoji.md
Last active July 30, 2024 02:10
Git Commit message Emoji
/*
Usage:
viewPager.setPageTransformer(true, new CardTransformer(0.7f));
*/
public class CardTransformer implements PageTransformer {
private final float scalingStart;
public CardTransformer(float scalingStart) {
super();
@rxaviers
rxaviers / gist:7360908
Last active July 30, 2024 07:56
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@dstroot
dstroot / install-redis.sh
Created May 23, 2012 17:56
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"