Skip to content

Instantly share code, notes, and snippets.

View kevinnls's full-sized avatar
🥱
procras-coding

Kevin Samuel kevinnls

🥱
procras-coding
View GitHub Profile
@kevinnls
kevinnls / added_file.md
Last active April 25, 2020 09:15
experimenting with string formatting in Python

I added this file

This file was added

###GLOBAL SECTION###
current_year = 2020
###FUNCTION DEF###
def age_finder(parameter): #get the parameter from function call (ln.16) and save in *parameter*
dob = parameter.split("/")
yob = int(dob[2])
result = current_year - yob #calculate result
return result #return *result* to funciton call (ln.14)
####MAIN###
name = "Epoch" #create var called name
#include<stdio.h>
void sayhello(){
printf("Hello World");
}
int main(){
int num;
char* number;
do{
printf("\njust say some number: ");
### BASH script to download the entire CS50 course material + project instructions
###DEFINE ALL OF THESE VARIABLES
root="http://cdn.cs50.net/mobile/2018/spring" #remove the final / in the link
quality=720p #imporant to retain the `p`
lec_count=12 #check in root on your browser
proj_count=2 #check in root on your browser
#UNCOMMENT THE NEXT LINE DOWNLOAD PROJECT INSTRUCTIONS

source (scroll down a bit)

import React from 'react';
 
const FirebaseContext = React.createContext(null);
 
export const withFirebase = Component => props => (
  <FirebaseContext.Consumer>
    {firebase => <Component {...props} firebase={firebase} />}
 

setting up your forked repo to sync with upstream

what?

common workflow in oss contributions is fork → edit → pr
when making repeated contributions, the master branch of the fork needs to be in sync with the original – the upstream
and here's one way to do that

the workings

private fun getResCards() {
val urlAllResCards = "http://13.235.250.119/v2/restaurants/fetch_result/"
val queue = Volley.newRequestQueue(activity as Context)
val allResCardsReq = object : JsonObjectRequest(Method.GET, urlAllResCards, null,
Response.Listener {
val response = it.getJSONObject("data")
if (response.getString("success") == "true") {
val data = response.getJSONArray("data")
for (i in 0 until data.length()) {

color codes in ... i think ANSI escape sequences?

declare -A fclr
declare -A bclr
declare -A mode
# modes
mode[0]="\[\e[0m\]"
mode[bold]="\[\e[1m\]"
mode[dim]="\[\e[2m\]"
mode[underline]="\[\e[4m\]"