Skip to content

Instantly share code, notes, and snippets.

@berkin
berkin / Windows - Cmd - recursively delete .svn folders
Created April 28, 2011 13:45
recursively delete .svn folders
FOR /R %d IN (.svn) DO rmdir /s /q “%d”
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- According to Heather Champ, former community manager at flickr,
you should not allow search engines to index your "Contact Us"
@berkin
berkin / SassMeister-input-HTML.html
Created March 24, 2014 09:07
Generated by SassMeister.com.
<div class="container">
<div class="sidebar">
test
</div>
<div class="content">
test<br />
test
test
test
test
@berkin
berkin / intent.js
Last active November 22, 2016 11:35
function Intent() {
const self = this;
let timer;
this.exec = function (callback, duration, ...args) {
self.clear();
timer = setTimeout(callback.bind(this, args), duration || 500);
};
this.clear = function() {
const regex = /(auto|scroll)/;
const parents = function (node, ps) {
if (node.parentNode === null) { return ps; }
return parents(node.parentNode, ps.concat([node]));
};
const style = function (node, prop) {
return getComputedStyle(node, null).getPropertyValue(prop);
import scrollParent from './scrolll-parent.js';
if (/Android [4-6]/.test(navigator.appVersion)) {
window.addEventListener('resize', () => {
if (document.activeElement.tagName === 'INPUT') {
window.setTimeout(() => {
const el = document.activeElement;
const rect = el.getBoundingClientRect();
const container = scrollParent(el);
<a href="http://stackoverflow.com/questions/9804280/how-to-prevent-focus-event-in-ie-when-mousedown-happens/17525223#17525223">http://stackoverflow.com/questions/9804280/how-to-prevent-focus-event-in-ie-when-mousedown-happens/17525223#17525223</a>
<br />
<input type="text" id="name">
<div onmousedown="return false" unselectable="on" id="suggest">
<div unselectable="on">mark</div>
<div unselectable="on">sam</div>
<div unselectable="on">john</div>
</div>
let tabbables;
function setTabbable(e) {
if (e.keyCode === 9) {
e.preventDefault();
// the tabbable elements can be changed.
tabbables = Array.prototype.slice.call(tabbable(this.currentStepView));
const isFocused = tabbables.some((item, i) => {
@berkin
berkin / Inconsolata-dz-Powerline.otf
Created December 5, 2016 08:31 — forked from qrush/Inconsolata-dz-Powerline.otf
vim-powerline patched fonts
@berkin
berkin / scroll-height.js
Created December 6, 2016 07:21
Scroll height of content
function scrollHeight() {
const body = document.body;
const html = document.documentElement;
return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
}