Skip to content

Instantly share code, notes, and snippets.

@artlili
artlili / delete.vue
Last active May 29, 2019 06:16
axios
var vm = new Vue ({
el: '#app',
data: {
result: ''
},
created: function(){
this.getResult();
},
@artlili
artlili / file.vue
Created May 26, 2019 15:57
Axios upload multiple files
<input type="file" ref="file" multiple="multiple">
submitFiles() {
let formData = new FormData();
for( var i = 0; i < this.$refs.file.files.length; i++ ){
let file = this.$refs.file.files[i];
console.log(file);
formData.append('files[' + i + ']', file);
@artlili
artlili / instagram.py
Created May 17, 2019 06:41
instagram
import aiohttp
import asyncio
import os
import re
from pathlib import Path
ROOT_URL = 'https://www.instagram.com/'
PROXY = 'http://127.0.0.1:1080'
HEADERS = {
'User-Agent':
::-webkit-scrollbar {
width: 8px;
background: inset 0 0 6px rgba(175,193,241,0.9);
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(175,193,241,0.9);
border-radius: 0px;
}
::-webkit-scrollbar-thumb {
border-radius: 5px;
JS Placeholder
$.widget( 'app.selectmenu', $.ui.selectmenu, {
_drawButton: function() {
this._super();
var selected = this.element
.find( '[selected]' )
.length,
placeholder = this.options.placeholder;
if (!selected && placeholder) {
@artlili
artlili / webpack.mix.js
Created May 16, 2019 12:01
laravel webpack mix
let mix = require('laravel-mix');
const path = require('path')
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
@artlili
artlili / mixins.scss
Last active May 31, 2019 11:16
px to rem
@function rem($pixels, $context: $base-font-size) {
@if (unitless($pixels)) {
$pixels: $pixels * 1px;
}
@if (unitless($context)) {
$context: $context * 1px;
}
@return $pixels / $context * 1rem;
@artlili
artlili / fonts.scss
Created May 15, 2019 20:22
Fonts function
$font: ("Bold": bold, "Regular": normal, "Medium": 500, "Thin": 100);
@each $style, $width in $font {
$url: $base-font-family + '-' + #{$style};
$rel_url: '/fonts/' + $url + '/' + $url;
@font-face {
font-family: $base-font-family;
src: url($rel_url + '.eot');
src: url($rel_url + '.eot?#iefix') format('embedded-opentype'),
url($rel_url + '.woff') format('woff'),
@artlili
artlili / click-outside.vue
Created May 15, 2019 20:20
click outside
Vue.directive('click-outside', {
bind () {
this.event = event => this.vm.$emit(this.expression, event)
this.el.addEventListener('click', this.stopProp)
document.body.addEventListener('click', this.event)
},
unbind() {
this.el.removeEventListener('click', this.stopProp)
document.body.removeEventListener('click', this.event)
},
@artlili
artlili / delete.vue
Created May 15, 2019 20:16
delete item in list
v-for="(event, index) in events"
...
<button ... @click="deleteEvent(index)"
deleteEvent: function(index) {
this.events.splice(index, 1);
}