Skip to content

Instantly share code, notes, and snippets.

@umer4ik
Created January 23, 2017 12:19
Show Gist options
  • Save umer4ik/088a2c0e5b938e0311c9925d06302cb5 to your computer and use it in GitHub Desktop.
Save umer4ik/088a2c0e5b938e0311c9925d06302cb5 to your computer and use it in GitHub Desktop.
my settings
vk.com##DIV[id="ads_left"]
music.yandex.ua##SPAN[class="no-ads link link_major "]
widgets.binotel.com$script
widget.siteheart.com$script
mc.yandex.ru/metrika/watch.js$script
www.google-analytics.com/analytics.js$script
an.yandex.ru
code.jivosite.com$script
call.chatra.io$script
push.world$script
'.source.js' :
'setTimeout Ecma':
'prefix': 'sett'
'body': """
setTimeout(() => {
${2}
}, ${1:1000});
"""
'setInterval Ecma':
'prefix': 'seti'
'body': """
setInterval(() => {
${2}
}, ${1:1000})
"""
'Anon func':
'prefix': 'anon'
'body': """
(() => {
${1}
})();
"""
'console.log':
'prefix': 'log'
'body': 'console.log(${1:"it works"});$2'
'use strict':
'prefix': 'us'
'body': "'use strict';"
'require node modeule':
'prefix': 'req'
'body': 'require(${1});'
'createServer http method':
'prefix': 'createServer'
'body': """
createServer(function(req,res){
res.writeHead(200, {'Content-type': 'text/html'});
res.end();
}).listen(80);
"""
'module.exports':
'prefix': 'exp'
'body': 'module.exports'
'return':
'prefix': 'ret'
'body': 'return ${1};'
'React Component':
'prefix': 'comp'
'body': """
export default class ${1:MyComponent} extends Component {
render() {
return (
${2}
);
}
}
"""
'React import':
'prefix': 'react'
'body': """
import React, { Component } from 'react';
${1}
"""
'Import Component':
'prefix': 'impcom'
'body': "import ${1:Component} from './${1:Component}';"
'Schema mongoose':
'prefix': 'sch'
'body': """
const mongoose = require('mongoose');
const schema = mongoose.Schema({
entity: {
type: String,
required: true
},
createdAt: {
type: Date,
required: true
},
updatedAt: {
type: Date,
required: true
}
});
const ${1:Model} = mongoose.model('${1:Model}', schema);
module.exports = ${1:Model};
"""
'Schema ES2015 mongoose':
'prefix': 'sche'
'body': """
import mongoose from 'mongoose';
const schema = mongoose.Schema({
entity: {
type: String,
required: true
},
createdAt: {
type: Date,
required: true
},
updatedAt: {
type: Date,
required: true
}
});
const ${1:Model} = mongoose.model('${1:Model}', schema);
export default ${1:Model};
"""
'.source.css.scss':
'Response mixin':
'prefix': 'resp'
'body': """
@include response(${1}) {
}
"""
'Response min mixin':
'prefix': 'respm'
'body': """
@include response-min(${1}) {
}
"""
'Response range mixin':
'prefix': 'respr'
'body': """
@include response-range(${1}, ${2}) {
}
"""
'Desktop only properties':
'prefix': 'deskp'
'body': """
@include desktop-properties {
${1}
}
"""
'Desktop hover':
'prefix': 'deskh'
'body': """
@include desktop-hover {
${1}
}
"""
'Retina media':
'prefix': 'ret'
'body': """
@include retina {
${1}
}
"""
'For loop':
'prefix': 'for'
'body': """
@for $i from ${1:1} through ${2:n} {
}
"""
'IE':
'prefix': 'ie'
'body': """
html[data-browser="ie"] & {
${1}
}
"""
'.text.html.basic':
'Slide':
'prefix': 'slide'
'body': """
<div class="clearfix start-page">
<a class="heading">${1}<i class="glyphicon glyphicon-link"></i></a>
</div>
"""
'Block':
'prefix': 'block'
'body': """
<!-- START BLOCK ${1} -->
.${1}${2}
<!-- END BLOCK ${1} -->
"""
'.source.pug':
# jade syntax snippets
'each val in [ 1, 2 ]':
'prefix': 'each'
'body': '''
each ${1:val} in ${2:[ bla ]}
${4:div= ${1:val}}
'''
'for( var i = 0; i < 10; i++ )':
'prefix': 'for'
'body': '''
- for( var ${1:i} = ${2:0}; ${1:i} ${3:<= 0}; ${1:i}${4:++} )
${5:div= ${1:val}}
'''
'extends ./templates/layout.jade':
'prefix': 'extends'
'body': '''
extends ${1:${2:./template}/${3:file}.${4:jade}}
$5
'''
'include ./includes/_file.pug':
'prefix': 'include'
'body': '''
include ${1:${2:./includes}/_${3:file}.${4:pug}}
'''
'- var name = value':
'prefix': 'var'
'body': '''
- var ${1:name} = ${2:value}
'''
'block blockname':
'prefix': 'block'
'body': '''
block ${1:blockname}
'''
'input':
'prefix': 'inp'
'body': '''
input(type="${1:text}", id="${2:name}", name="${3:name}")
'''
// ==UserScript==
// @name Viewport width and height
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://localhost:3000/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var div = document.createElement('div');
var w,h;
(() => {
w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
div.style.position = 'fixed';
div.style.fontSize = '1.5em';
div.style.backgroundColor = "#000";
div.style.color = '#fff';
div.style.top = 0;
div.style.right = 0;
div.style.padding = '3px';
div.innerHTML = w+'x'+h;
div.style.zIndex = "10000";
div.style.fontFamily = "monospace";
div.style.pointerEvents = "none";
document.body.appendChild(div);
})();
window.addEventListener('resize', function(){
w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
div.innerHTML = w+'x'+h;
});
})();
// ==UserScript==
// @name Block yandex music ads
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://music.yandex.ua/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
setInterval(function(){
var ads = document.querySelectorAll('.smalladv');
for (var i = 0; i<ads.length; i++) {
ads[i].remove();
}
},2000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment