Skip to content

Instantly share code, notes, and snippets.

View Jay-flow's full-sized avatar
🎯
Focusing

Jay-flow Jay-flow

🎯
Focusing
View GitHub Profile
package io.bagstation.bagstation;
import android.util.Log;
import android.app.Activity;
import android.os.Build;
import android.webkit.WebViewClient;
import android.webkit.WebView;
import android.content.Intent;
import android.content.ActivityNotFoundException;
import android.net.Uri;
@Jay-flow
Jay-flow / example_code.py
Last active May 7, 2020 01:06
example_code for python comprehension
def example_code(list_of_product_data):
return [product for product in list_of_product_data if product == 'specific_kind']
@Jay-flow
Jay-flow / example_code.py
Created May 7, 2020 01:10
exampe_code for python comprehension
def example_code(list_of_product_data):
kinds = []
for product in list_of_product_data:
if product == 'specific_kind':
kinds.append(product)
return kinds
@Jay-flow
Jay-flow / example_code_before_the_change.py
Created May 7, 2020 01:17
example_code for python dictinary comprehension
def example_code(list_of_product_data):
kinds = {}
for index, product in enumerate(list_of_product_data):
if product == 'specific_kind':
kinds[index] = product
return kinds
@Jay-flow
Jay-flow / example_code_after_the_change.py
Last active May 7, 2020 01:41
example code for python dictinary comprehension
def example_code(list_of_product_data):
return {
index: product for index, product in enumberate(list_of_product_data)
if prodcut == 'specific_kind'
}
@Jay-flow
Jay-flow / StrategyPattern.java
Last active June 21, 2020 06:16
Strategy pattern
public abstract class Animal {
SwimmingBehavior swimmingBehavior;
SoundBehavior soundBehavior;
public abstarct void display();
public void performSwimming() {
swimmingBehavior.swim();
}
@Jay-flow
Jay-flow / global_variable.c
Last active June 25, 2020 10:42
How the computer handles variables
#include <stdio.h>
// this is a global variable.
int a = 1;
// Can be used within a function without declaration.
void changeValue() {
a = 5
}
@Jay-flow
Jay-flow / local_variable.c
Last active June 25, 2020 10:56
How the computer handles variables
#include <stdio.h>
int main(void) {
//this is a local variable.
int a = 10;
if (1) {
int a = 3
}
printf("%d", a);
system("pause");
@Jay-flow
Jay-flow / static_variable.c
Created June 25, 2020 11:15
How the computer handles variables
#include <stdio.h>
void addValue() {
// It doesn't reset every time I call.
static int a = 10;
a = a + 10;
printf("%d\n", a);
}
int main(void) {
@Jay-flow
Jay-flow / static_variable.c
Last active June 25, 2020 11:23
How the computer handles variables
#include <stdio.h>
void addValue() {
// It doesn't reset every time I call.
static int a = 10;
a = a + 10;
printf("%d\n", a);
}
int main(void) {