Skip to content

Instantly share code, notes, and snippets.

@Fanna1119
Fanna1119 / js
Created May 17, 2018 18:13
img compress.js
$('form').submit(function (e) {
e.preventDefault();
var formData = new FormData($(this));
var image_file = $("#file_select")[0].files[0];
if (!image_file) {
return;
@Fanna1119
Fanna1119 / faster_requests.py
Created June 20, 2018 10:06
Faster python3 requests using built in http.client
import http.client
import ujson
def json_dump(data):
return ujson.dumps(ujson.loads(data), indent=4, escape_forward_slashes=False)
def search_web(host, url):
connection = http.client.HTTPConnection(host=host, timeout=10)
connection.request(method="GET", url=url)
@Fanna1119
Fanna1119 / scrape.py
Created October 6, 2018 08:06
scrape html without bloatiful soup
import http.client
from lxml import html
conn = http.client.HTTPSConnection("www.thesaurus.com")
conn.request("GET", "/browse/honesty")
r1 = conn.getresponse()
data1 = r1.read()
# print(data1)
# raw html
@Fanna1119
Fanna1119 / vue2.vue
Created July 22, 2020 12:47
vue2 -> vue3 comparison - VUEJS
<template>
<div>
<h1 class="timer">{{toMin}}</h1>
</div>
</template>
<script>
export default {
data() {
return {
@Fanna1119
Fanna1119 / App.vue
Created November 12, 2020 09:40
vue 3 multiple v-models
<template>
<settings
v-model:day="store.day"
v-model:month="store.month"
v-model:year="store.year"
/>
<timeleft />
</template>
<script>
@Fanna1119
Fanna1119 / App.vue
Last active November 14, 2020 09:16
v-models, emits, vue3
<template>
<datpicker
v-model:day="store.day"
v-model:month="store.month"
v-model:year="store.year"
@birthDate="checkit"
/>
</template>
<script>
<template>
<main class="hero-full">
<div class="text-center text-6xl font-bold text-white hero-body">
<router-view />
<Footer />
</div>
</main>
</template>
@Fanna1119
Fanna1119 / progressbar.vue
Last active March 9, 2021 06:57
simple vue3 progressbar
<template>
<div class="progress" :data-label="percent + '%'">
<span
class="value"
:style="{ width: percent + '%', backgroundColor: getColor }"
></span>
</div>
<input type="range" min="0" max="100" v-model="percent" />
</template>
import add from "lodash-es/add";
import after from "lodash-es/after";
import ary from "lodash-es/ary";
import assign from "lodash-es/assign";
import assignIn from "lodash-es/assignIn";
import assignInWith from "lodash-es/assignInWith";
import assignWith from "lodash-es/assignWith";
import at from "lodash-es/at";
import attempt from "lodash-es/attempt";
import before from "lodash-es/before";
@Fanna1119
Fanna1119 / vuex.js
Created March 10, 2021 17:02
vuex3
import Vue from 'vue';
import Vuex from 'vuex';
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex);
export const store = new Vuex.Store({
plugins: [createPersistedState()],
state: {
scrums: [],
activescrum: '',