Skip to content

Instantly share code, notes, and snippets.

vim-plug:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 17 2017 10:48:22)
Included patches: 1-1305
Compiled by yramagicman@k-nine
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white

-autoservername +float +mouse_urxvt -tcl

@yramagicman
yramagicman / list-comprehensions-ftw.py
Created February 19, 2015 04:53
List comprehensions ftw
files = os.walk(file_location)
def getNames(files):
filtered = [i for i in files if '.git' not in i[0]]
names = []
for dirs in filtered:
names = names + [dirs[0] + '/' + d for d in dirs[2]]
return names
print getNames(files)
@yramagicman
yramagicman / confused.html
Created June 14, 2013 01:30
Is this a bug? Or a feature?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Clock</title>
</head>
<body>
<div id="clock">
<!-- well, I've got my clock div, and I'm going to make it work with JS -->
</div>
(function() {
var divs = $('.page'),
$next = $('.next'),
$prev = $('.prev'),
that = this,
loc, page;
for (var i = divs.length - 1; i >= 0; i--) {
var z = i + 1;
divs[i].style.left = i * 100 + '%';
divs[i].id = 'page-' + (i + 1);
@yramagicman
yramagicman / Guides.js
Last active December 15, 2015 16:19
Create guides on a webpage
(function () {
'use strict';
var vGuidePos = '50%';
var hGuidePos = '50%';
var vguide = document.createElement('div');
var hguide = document.createElement('div');
var vstyle = vguide.style;
var hstyle = hguide.style;
vstyle.borderLeft = ' 1px solid red';
vstyle.width = '1px';
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
@yramagicman
yramagicman / pad.js
Last active December 15, 2015 01:59
add a pad around dropdown menus to compensate for mouse error
(function() { //jQuery function that adds a pad around menus
'use strict';
var x, j;
j = jQuery.noConflict();
//detect elements
var wrapPad = function(elem) {
if (j(elem).length) {
x = j(elem);
x.wrap('<div class="pad">');
@yramagicman
yramagicman / scrollLocation.js
Last active December 14, 2015 04:09
jquery function for single page web sites that facilitates navigation
function scrollLocation( selectorString, id, linkLoc, offset) {
event.preventDefault();
var loc = window.location;
var url = loc.pathname;
window.location = url + linkLoc;
var scrollPos = $(document).scrollTop() - offset;
$(document).scrollTop(scrollPos);
$(selectorString).removeClass('active');
$(id).addClass('active');
}
@yramagicman
yramagicman / loopEls.js
Last active December 12, 2015 12:48
Simple function to loop through elements in a slideshow/slider format
var loop = function (wrapper, kids, fade, delay) {
var count = $(wrapper).children().length,
selector = [];
$(wrapper).children().fadeOut(0);
for (var i = 1; i < count + 1; i++) {
selector[i] = $(wrapper + ' ' + kids + ':nth-child(' + i + ')');
}
var z = 1;
selector[z].each(function () {
$(this).fadeIn(fade).delay(delay).fadeOut(fade, function () {