Skip to content

Instantly share code, notes, and snippets.

View witmin's full-sized avatar
🎢
Ready? Go!

Millie witmin

🎢
Ready? Go!
View GitHub Profile
@witmin
witmin / upgrade-node-dependencies.md
Last active November 15, 2021 09:26
Check and upgrade node dependencies version

To update to a new major version all the packages, install the npm-check-updates package globally:

npm install -g npm-check-updates

then run it:

ncu -u
@witmin
witmin / drinks-exchange-math.py
Created February 14, 2021 03:56
2021春晚小学数学题
# 2021年浙江卫视春晚让郭冬临喝了很多瓶水的小品里的一道数学题
# 题面:小明有10元钱,一瓶饮料2元钱,2个瓶盖可以换一瓶饮料,4个瓶身可以换一瓶饮料
# 问小明最多可以用这10元钱取得多少瓶饮料?
import math
# 持有的钱
money = 10
# 饮料单价
price = 2
# 瓶盖兑换规则
@witmin
witmin / ffmpeg-mp4-to-animated-webp.md
Last active May 31, 2024 06:41
Convert MP4 file to animated WebP in ffmpeg

Convert MP4 file to animated WEBP file in ffmpeg CLI

1. Install ffmpeg CLI through homebrew

In terminal.app, install ffmpeg through homebrew

brew install ffmpeg

Validate the installation:

@witmin
witmin / scrollToSticky.html
Last active August 28, 2019 09:25
Pure JavaScript scroll to stick function for vue.js and CSS styles
<html>
<head>
.editor-main-menu.sticky {
position: fixed;
top: 0;
width: 100%;
z-index: 10;
}
.editor-main-menu.sticky + .sibling-element {

My code when taking the project in Jupyter notebook for DataQuest: https://www.dataquest.io/m/218/guided-project%3A-exploring-gun-deaths-in-the-us/9/next-steps

import csv
f = open("guns.csv", "r")
data = list(csv.reader(f))
print(data[0:4])

[['', 'year', 'month', 'intent', 'police', 'sex', 'age', 'race', 'hispanic', 'place', 'education'], ['1', '2012', '01', 'Suicide', '0', 'M', '34', 'Asian/Pacific Islander', '100', 'Home', '4'], ['2', '2012', '01', 'Suicide', '0', 'F', '21', 'White', '100', 'Street', '3'], ['3', '2012', '01', 'Suicide', '0', 'M', '60', 'White', '100', 'Other specified', '4']]

@witmin
witmin / googlemap-api-markers-infowindows.html
Created November 19, 2017 08:59
Enhanced method to create multiple markers and marker clusterer with simplified code.
<!-- This is the corresponding "starter code" for 07_Markers/Infowindows in Udacity and Google's Maps
API Course, Lesson 1 -->
<html>
<head>
<!-- styles put here, but you can include a CSS file and reference it instead! -->
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
@witmin
witmin / fetch-api.js
Created November 11, 2017 13:56
Fetch API ES6 - New York Times's api by search key work and insertAdjacentHTML to html page
(function () {
const form = document.querySelector('#search-form');
const searchField = document.querySelector('#search-keyword');
let searchedForText;
const responseContainer = document.querySelector('#response-container');
form.addEventListener('submit', function (e) {
e.preventDefault();
responseContainer.innerHTML = '';
searchedForText = searchField.value;
@witmin
witmin / insert_lang_span.js
Last active October 24, 2017 00:34
A simple jQuery function to insert a <span> with 'lang' attribute to a different language text for font decoration
/**
* @description function to replace text with a English language attribute
* @param {string} element - html element that need to be check and updated
* @param {string} text - text to be replaced
* @param {string} langCode - the language attribute that needs to be included.
*/
function insertLangSpan(element, text, langCode) {
var newHTML = '<span lang="' + langCode + '">'+ text +'</span>';
@witmin
witmin / _simple-mediaqueries-mixin-pt.scss
Last active May 8, 2021 16:21
Simple media queries mixins for phone and tablet. Including variables of the basic mobile size, portrait and landscape orientation in sass. Can be quick applied in a mini site.
//Simple media queries mixins for phone and tablet. Including variables of the basic mobile size, portrait and landscape orientation in sass. Can be quick applied in a mini site.
// Author: Millie Lin
// website: www.millielin.com
// ***** Breakpoints for Responsive Screen
// width scale for phone
$phone-min-width: 320px !default;
$phone-max-width: 504px !default;
// height scale for phone
$phone-min-height: 346px !default;