Skip to content

Instantly share code, notes, and snippets.

View amelieykw's full-sized avatar

amelieykw amelieykw

  • Sophia Antipolis, France
View GitHub Profile
@amelieykw
amelieykw / find the minimum in subarray.js
Last active June 14, 2018 15:36
[Selection Sorting]#DataStructure #algorithm #selectionSorting
var indexOfMinimum = function(array, startIndex) {
// Set initial values for minValue and minIndex,
// based on the leftmost entry in the subarray:
var minValue = array[startIndex];
var minIndex = startIndex;
// Loop over items starting with startIndex,
// updating minValue and minIndex as needed:
for (var i=minIndex+1; i<array.length;i++){
if(array[i]<minValue){
@amelieykw
amelieykw / Binary Search by Javascript.js
Last active June 14, 2018 13:41
[Binary Search]#DataStructure #algorithm #binarySearch #Javascript
/* Returns either the index of the location in the array,
or -1 if the array did not contain the targetValue */
var doSearch = function(array, targetValue) {
var min = 0;
var max = array.length - 1;
var guess;
var guessTimes = 0;
while(max >= min){
guessTimes++;
guess = Math.floor((max+min)/2);
@amelieykw
amelieykw / Adding or Removing Data.md
Last active May 29, 2018 08:23
[ChartJS | Updating Charts] #ChartJS

Adding and removing data is supported by changing the data array. To add data, just add data into the data array as seen in this example.

function addData(chart, label, data) {
    chart.data.labels.push(label);
    chart.data.datasets.forEach((dataset) => {
        dataset.data.push(data);
    });
    chart.update();
}
@amelieykw
amelieykw / demo.html
Created May 29, 2018 08:20
[ChartJS | multiple chartjs in the same page] #ChartJS
<div style="width: 50%">
<canvas id="canvas" height="450" width="600"></canvas>
</div>
<div style="width: 50%">
<canvas id="canvas2" height="450" width="600"></canvas>
</div>
@amelieykw
amelieykw / introduction.md
Last active May 29, 2018 08:18
[Grails Programmer : How to integrate Chart.js to load Dynamic JSON data in a Grails 3 application? ] #ChartJS #JSON #loadJSONdata
@amelieykw
amelieykw / MySQL table.md
Last active November 23, 2022 21:15
[ChartJS | How to draw Bar graph using data from MySQL table and PHP] #ChartJS #insertDataofJSON

Score table

CREATE TABLE `score` (
  `playerid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `score` int(11) DEFAULT '0',
  PRIMARY KEY (`playerid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Score table data

@amelieykw
amelieykw / introduction.md
Created May 16, 2018 08:12
[UML - Basic Concepts] #UML #BasicConcepts

@amelieykw
amelieykw / Use Case Diagram.md
Last active May 16, 2018 08:10
[UML - Use Case Diagrams] #UML #UseCaseDiagrams #UseCase #actors #aParticularFunctionalityOfaSystem

Dynamic behavior means the behavior of the system when it is running/operating.

5 diagrams to model Dynamic behavior :

  1. Use Case
  2. activity
  3. sequence
  4. collaboration
  5. Statechart

Use Case Diagram

One typical workflow in creating Django apps is to "create models and get the admin sites up and running as fast as possible", so your staff (or clients) can start populating data. Then, develop the way data is presented to the public.

1. Design your model

Object-relational mapping (ORM, O/RM, and O/R mapping tool)

object-relational mapper in which you describe your database layout in Python code data-model syntax

E.X.

from django.db import models
@amelieykw
amelieykw / filter_dropdown_click.html
Created April 26, 2018 08:51
[Filter Dropdown Click] #filter #dropdown #click #W3.CSS #CSS #HTML
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<body>
<div class="w3-container">
<h2>Filter Dropdown Click</h2>
<p>Click on the dropdown and search for a specific link inside the input field.</p>