Skip to content

Instantly share code, notes, and snippets.

View h4's full-sized avatar
💭
I may be slow to respond.

Mikhail Baranov h4

💭
I may be slow to respond.
View GitHub Profile
@h4
h4 / rename.py
Created December 8, 2014 11:29
rename script
import os
prefix = 'landing__'
def visit(a, dir, files):
dirname = os.path.abspath(dir)
for fname in files:
oldname = os.path.join(dirname, fname)
if os.path.isdir(oldname):
return
newname = os.path.join(dirname, '{}{}'.format(prefix, fname))
@h4
h4 / package.json
Created December 24, 2014 20:35
package sample
{
"name": "ololo",
"version": "1.0.0",
"description": "",
"main": "",
"directories": {
"test": "test"
},
"scripts": {
"runserver": "cd ./src && python -m SimpleHTTPServer"
var fs = require('fs')
, gm = require('gm');
// resize and remove EXIF profile data
var fname = __dirname + '/square.svg';
var newname = __dirname + '/square.png';
gm(fname)
@h4
h4 / imageAsElem.styl
Created February 25, 2015 12:23
Вставка картинки как элемент блока
$ctx = my-cool-block // имя блока, без точки, без кавычек. Это важно
.{$ctx} {
&__elem {
background url(s('%s__image.svg', $ctx)) // интерполяция есть только для имён селекторов. Поэтому вызываем `s()`
}
}
_typeCheckboxesCurrentValue: function() {
return this._getTypeCheckboxes()
.filter(function(bCheckbox) {
return bCheckbox.isChecked();
})
.map(function(bCheckbox) {
return bCheckbox.val();
})
.reduce(function(prev, cur) {
return cur || prev;
$(function() {
var $citySelect = $('#city-select'),
STORAGE_ITEM_NAME = 'saveCity';
$citySelect.on('change', function () {
var url = $citySelect.val();
if (url !== '') {
localStorage.setItem(STORAGE_ITEM_NAME, url);
window.location = url;
@h4
h4 / enb.js
Last active August 29, 2015 14:24
module.exports = function(config) {
config.setLanguages(["ru"]);
config.mode("development", function() {
config.node("bundles", function(nodeConfig) {
nodeConfig.addTechs([
[ require("enb/techs/file-copy"), { sourceTarget: "?.js", destTarget: "_?.js" } ],
[ require("enb/techs/file-copy"), { sourceTarget: "?.css", destTarget: "_?.css" } ],
[ require("enb/techs/file-copy"), { sourceTarget: "?.{lang}.js", destTarget: "_?.{lang}.js" } ]
]);
});,config.node("wundles", function(nodeConfig) {
@h4
h4 / Install.md
Last active August 29, 2015 14:27 — forked from pepelsbey/Install.md

System

  1. Set up iCloud Keychain
  2. Remove icons and hide Dock
  3. Default address in iMessage
  4. Install Updates
  5. Add Ru Input Sources
  6. Set up Shortcuts
  7. Add text shortcuts Text
@h4
h4 / list.txt
Created October 10, 2015 14:32
My brew packages
ant
atk
autoconf
automake
cairo
cloog-ppl015
composer
cryopng
curl
defluff
@h4
h4 / slack-channels.js
Created October 26, 2015 09:00
Спискок всех каналов слака
function getChannelsList(callback) {
var url = 'https://slack.com/api/channels.list?token=' + authToken + '&exclude_archived=1';
request.get(url, function (error, httpResponse, body) {
if (error) {
callback(null, error);
}
var response = JSON.parse(body);
var channels = response.channels.map(function (channel) {
return {
id: channel.id,