Skip to content

Instantly share code, notes, and snippets.

View zmts's full-sized avatar
🇺🇦
russian warship go f*uck yourself

Sasha Zmts zmts

🇺🇦
russian warship go f*uck yourself
View GitHub Profile
@zmts
zmts / addPic.html
Last active January 7, 2017 20:36
Add image from array Vue js
<!-- something like this -->
<img v-if="someObject.someArray[0].image" :src="someObject.someArray[0].image"/>
<!-- or this -->
<img v-if="item.content[0]" v-bind:src="item.content[0].cardurl">
@zmts
zmts / select2.html
Created January 10, 2017 12:55
select2 "required problem" solution
<div class="select2-wrapper">
<select required>
...
</select>
</div>
<style>
.select2-offscreen,
.select2-offscreen:focus {
clip: rect(0 0 0 0) !important;
!!"" // false
!!0 // false
!!null // false
!!undefined // false
!!NaN // false
!!"hello" // true
!!1 // true
!!{} // true
!![] // true
@zmts
zmts / menu.html
Created February 9, 2017 11:07
Make menu from select
<select name="forma" onchange="location = this.value;">
<option value="Home.php">Home</option>
<option value="Contact.php">Contact</option>
<option value="Sitemap.php">Sitemap</option>
</select>
// https://github.com/felixge/node-formidable
function formidablePromise (req, opts) {
return new Promise(function (resolve, reject) {
var form = new formidable.IncomingForm(opts)
form.parse(req, function (err, fields, files) {
if (err) return reject(err)
resolve({ fields: fields, files: files })
}
})
@zmts
zmts / index.html
Last active March 30, 2017 16:52
Dotted font effect (via CSS)
<!-- demo http://codepen.io/rqnix/pen/mWQEQM -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=Anton" rel="stylesheet">
<title>Document</title>
</head>
<body>
@zmts
zmts / pg-promise example select
Last active April 2, 2017 21:51
sql, postgresql, expressjs, nodejs
app.get("/pg", function(req, res) {
connection.any("SELECT * FROM people", true)
.then(function(data) {
res.format({
"application/json": function() {
res.status(200).send(data);
console.log(data);
}
});
})
@zmts
zmts / gulp.md
Last active April 2, 2017 22:02
gulp not cleared .tmp after a file change; fountainjs, angular, angular1

Add clean task in inject task

gulp.task('inject', gulp.series('clean', gulp.parallel('styles', 'scripts'), 'inject'));

After any changes in js files .tmp folder is cleaning

And don't forget remove before make npm run serve:dist or npm run build

@zmts
zmts / regexp.js
Last active July 4, 2017 18:55
regexp, regular expression, leave only numbers and point (Numbers decimal)
' so me_shit_&$^%*5-_5.55'.replace(/[^0-9.]/g, '')
// >> 55.55
@zmts
zmts / material_icons.md
Last active July 8, 2017 12:32
Material icons, проблема отображения

Столкнулся спроблемой не отображались Material иконки.

<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">

Проблема была скрыта в reset.css он перекрывал стили Material а именно тег <i>. Решение убрать этот тег из ресета.

/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/