Skip to content

Instantly share code, notes, and snippets.

View Tusko's full-sized avatar

Tusko Trush Tusko

View GitHub Profile
@Tusko
Tusko / wakaTimer.js
Created January 16, 2016 09:44
wakaTimer
var wakaTimer;
function blurWindow(){
wakaTimer = setInterval(function(){
handleAction(true);
}, 5e3);
}
function setupEventListeners() {
MainViewManager.on('currentFileChange', function () {
@Tusko
Tusko / valign.css
Created February 2, 2016 09:38
valign css
// Vertical align inside DIV
// <span class="valign">Some content</span>
// <span class="vfix"></span>
.valign {display: inline-block;vertical-align: middle; max-width: 98%}
.vfix {display: inline-block;height: 100%;vertical-align: middle;width: 0}
$green: #008744;
$blue: #0057e7;
$red: #d62d20;
$yellow: #ffa700;
// scaling... any units
$width: 30px;
.showbox {
-webkit-transition: all .5s ease;
@Tusko
Tusko / gap.js
Created May 11, 2016 13:53
GAP Parallax
function exGAP(){
'use strict';
$('.is__gap').each(function(){
var t = $(this),
off = t.offset().top,
step = t.data('step'),
reverse = t.hasClass('__reverse') ? -1 : 1;
if( screen() >= off - screen('height')) {
t.css('background-position','50% '+ reverse * parseInt( ( screen() - off ) / (step || 4) , 10) + 'px');
}
@Tusko
Tusko / .sh
Created June 7, 2016 15:41
OS X Folders at top in Finder
cd /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/ (or whatever language you're running)
sudo plutil -convert xml1 InfoPlist.strings
sudo nano InfoPlist.strings (edit folder here)
sudo plutil -convert binary1 InfoPlist.strings
@Tusko
Tusko / woo-tags.php
Last active June 10, 2016 06:44
Alphabet Woocommerce Tags
<?php function alpha_brands(){
$num = range(0, 9);
$alpha = range('A','Z');
$abc_cyr = array();
foreach(range(chr(0xC0), chr(0xDF)) as $b) $abc_cyr[] = iconv('CP1251', 'UTF-8', $b);
$characters = array_merge($num, $alpha, $abc_cyr);
$result = array();
$t_args = array(
'hide_empty' => 0
@Tusko
Tusko / di.js
Last active June 12, 2016 15:24
Deffered iframe
function resizeIframe(iframe) {
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
}
function iFrameLoaded( id, src ) {
var deferred = $.Deferred(),
iframe = $( "<iframe class='hiddenFrame' onload='resizeIframe(this)' width='100%' scrollin='no'></iframe>" ).attr({
"id": id,
"src": src
});
@Tusko
Tusko / mobfix.js
Last active June 22, 2016 12:01
Fix for :focus on touch devices, when parent has position:fixed
var supportsTouch = window.hasOwnProperty('ontouchstart') || window.navigator.msPointerEnabled ? true : false,
$.fn.mobileFix = function (options) {
var $parent = $(this),
$fixedElements = $(options.fixedElements);
$(document)
.on('focus', options.inputElements, function(e) {
$parent.addClass(options.addClass);
})
@Tusko
Tusko / in-numberic.scss
Last active June 23, 2016 13:03
Is Numberic input
.input-number-box {
@include transform(translate3d(0,0,0));
@include border-radius(5px);
position: relative;
background: #000;
overflow: hidden;
text-align: left;
width: 100px;
* {@include transform(translate3d(0,0,0));}