Skip to content

Instantly share code, notes, and snippets.

@akrawchyk
akrawchyk / gist:3946510
Created October 24, 2012 14:50
Errors for neocomplcache#enable
Error detected while processing function vital#of..vital#_9813ec6#new..<SNR>85_load..<SNR>85__import:
line 22:
E480: No match: `=path`
Error detected while processing function vital#of..vital#_9813ec6#new..<SNR>85_load:
line 21:
E171: Missing :endif
@akrawchyk
akrawchyk / gist:3946528
Created October 24, 2012 14:53
Insert mode neocomplcache errors
line 8:
E121: Undefined variable: g:neocomplcache_context_filetype_lists
Error detected while processing function <SNR>82_on_moved_i..<SNR>82_get_cur_text..neocomplcache#get_context_filetype..<SNR>82_set_context_filetype..<SNR>82_get_context_filetype:
line 8:
E116: Invalid arguments for function has_key(g:neocomplcache_context_filetype_lists, filetype) && !empty(g:neocomplcache_context_filetype_lists[filetype])
Error detected while processing function <SNR>82_on_moved_i..<SNR>82_get_cur_text..neocomplcache#get_context_filetype..<SNR>82_set_context_filetype..<SNR>82_get_context_filetype:
line 8:
E15: Invalid expression: has_key(g:neocomplcache_context_filetype_lists, filetype) && !empty(g:neocomplcache_context_filetype_lists[filetype])
Error detected while processing function <SNR>82_on_moved_i..<SNR>82_get_cur_text..neocomplcache#get_context_filetype..<SNR>82_set_context_filetype:
line 26:
@akrawchyk
akrawchyk / SASS Bootstrap 3 grid
Last active December 23, 2015 11:39
Bootstrap 3 basic grid system in SCSS. Omits offsetting, nesting, and ordering for simplicity.
// variables
$bp-small: em(768) !default;
$bp-medium: em(992) !default;
$bp-large: em(1200) !default;
$grid-columns: 12 !default;
$grid-gutter-width: em(30) !default;
$grid-wrapper-small: em(750) !default;
$grid-wrapper-medium: em(970) !default;
$grid-wrapper-large: em(1170) !default;
@akrawchyk
akrawchyk / SASS opposite direction function
Created September 27, 2013 19:45
Reverses a CSS direction, accepting a single direction or a list.
@function get-opposite-direction($direction) {
$opposite-direction: center;
@if $direction == top {
$opposite-direction: bottom;
}
@if $direction == bottom {
$opposite-direction: top;
}
@if $direction == left {
@akrawchyk
akrawchyk / random bootstrap popover content
Last active January 4, 2016 04:09
Replacing bootstrap popover content on each click
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>demo</title>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
</head>
@akrawchyk
akrawchyk / entypo sass map
Created April 7, 2014 18:23
Using SASS maps to generate entypo icon font classes
$entypo-icons: (
search : \1f50d,
flag : \2691
// ...
);
@each $icon, $code in $entypo-icons {
.entypo-#{$icon}:before {
content: '#{$code}';
}
@akrawchyk
akrawchyk / inputToJSON
Last active August 29, 2015 14:00
Serialize input to JSON
/**
* Creates JSON for a single input field
*
* e.g. article[id] = 1 => { article: {id: 1}}
*
* @param {Node} inputElem - :input element to serialize
* @returns {object}
*/
var serializeInputToJSON = function(inputElem) {
var name = inputElem.name;
@akrawchyk
akrawchyk / gist:16ffe8c128e03e58b546
Created March 5, 2015 03:20
ternary operator js
var jobsCountRemaining = 2;
// ternary
var completed = jobsCountRemaining === 0 ? true : false;
return completed;
// if-else
if (jobsCountRemaining === 0) {
completed = true;
} else {

The problem:

Need to find paths to SCSS assets installed with npm to be used in a gulp script with gulp-sass.

The progress:

const nodeModules = (() => {
  let base = 'node_modules';
 let modulesPath;
@akrawchyk
akrawchyk / crawler.js
Last active June 20, 2016 18:40
Streams HTML from phantomjs after document load as ndjson
/**
* Crawler
* PhantomJS writes to stream with content of crawled pages
* Streams HTML from phantomjs after document load as ndjson
*/
'use strict'
const ndjson = require('ndjson')
const phantom = require('phantom')