Skip to content

Instantly share code, notes, and snippets.

@kerotaa
kerotaa / _establish-break.scss
Last active December 23, 2015 23:49
いい感じな改行を実現するSCSS mixin。
@mixin establish-break($body: true, $pre: true, $inline: true, $table: true) {
@if $body {
body {
word-wrap: break-word;
}
}
@if $pre {
pre {
overflow: auto;
@mixin linear-gradient($start, $color-stops...) {
$start: unquote($start);
$vendors-direction: null;
$directions: top left bottom right;
@if str-index($start, "top") > 0 or str-index($start, "left") > 0 or str-index($start, "bottom") > 0 or str-index($start, "right") > 0 {
$proc: ();
@for $i from 1 to 4 {
@if str-index($start, nth($directions, $i)) > 0 {
$proc: append($proc, nth($directions, if($i < 3, $i + 2, $i - 2)));
path = require 'path'
grunt.registerMultiTask 'template_concat', ->
indent = (text, indentStr, width)->
lines = text.split "\n"
t = ''
for i in [0...width]
t += indentStr
lines.forEach (line, index)->
lines[index] = t + line
<?xml version="1.0"?>
<root>
<item>
<name>Change Shift_Underscore(_) to Singlequote(')</name>
<identifier>private.swap_singlequote_and_backquote</identifier>
<autogen>
--KeyToKey--
KeyCode::JIS_UNDERSCORE, VK_SHIFT,
KeyCode::KEY_7, VK_SHIFT
</autogen>
# CSSO on stylesheet saved
on_stylesheet_saved do |filename|
if File.exists?(filename)
system("csso #{filename} #{filename}")
end
end
@mixin close-button($size: 32px, $border-width: 1px, $color: #000) {
@include inline-block;
position: relative;
width: $size;
height: $size;
&:hover {
cursor: pointer;
}
@kerotaa
kerotaa / ga-count.js
Created September 16, 2013 23:04
クリックカウントをdata属性で管理したいときに使う。
$('[data-ga-count]').on('click.ga', function() {
var $this = $(this),
data = $this.data('ga-count'),
splitter = ':';
if (data.indexOf(splitter) == -1 || $this.data('ga-counted')) return true;
$this.data('ga-counted', true);
data = data.split(splitter);
_gaq.push(['_trackEvent', data[0], 'click', data[1]]);
});
strong {
position: relative;
}
strong::after {
display: inline-block;
content: '';
position: absolute;
z-index: -1;
bottom: 0;
@kerotaa
kerotaa / throttle
Created September 13, 2013 06:51
easy throttle
function throttle(fn, interval) {
var timer = null;
return function() {
var self = this, args = arguments;
if (!timer) {
timer = setTimeout(function() {
timer = null;
fn.apply(self, args);
}, interval);
}
#target photoshop
app.bringToFront();
(function(global) {
if (!documents.length) return;
function getSelectedLayers() {
var layers, gL, desc11, ref9, ref10;
layers = [];