Skip to content

Instantly share code, notes, and snippets.

View krukid's full-sized avatar

Viktors Buls krukid

  • Juro
  • Riga, Latvia
View GitHub Profile
@krukid
krukid / NOTES
Last active August 13, 2020 21:57
mint-object-explorer
potentially useful features/ tweaks:
1. persistent node toggle across searches
2. node toggles expand AND highlight (alt color?)
3. opacity darken bg for nested containers
4. search expressions (key="foo" value=2 AND value=5)
// key is exactly "foo" OR value contains both 2 and 5
@krukid
krukid / components.mint-toast-item.js
Last active September 26, 2019 00:07
mint-toast-v2
import Component from '@ember/component';
import { computed } from '@ember/object';
import { later, next } from '@ember/runloop';
import $ from 'jquery';
const TEMP_DELAY = 3000;
const SLIDE_DELAY = 300;
const FADE_IN_DELAY = SLIDE_DELAY * 1.3;
const FADE_OUT_DELAY = SLIDE_DELAY * 0.7;
@ayamflow
ayamflow / gist:b602ab436ac9f05660d9c15190f4fd7b
Created May 9, 2016 19:10
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@saippuakauppias
saippuakauppias / share.js
Created September 1, 2015 10:43
Share text or link in vk (vkontakte, vk.com), fb (facebook, facebook.com), tw (twitter, twitter.com)
/********************************************************************
*
* Share social http://habrahabr.ru/post/156185/
*
*********************************************************************/
function Share(purl, ptitle, pimg, text) {
'use strict';
this.purl = purl;
this.ptitle = ptitle;
@hullen
hullen / mobileCheck.js
Last active May 23, 2021 12:49
Detects mobile devices: phones, tablets. mobileCheck is a lightweight Javascript utils for detecting mobile devices and tablets. Its using User Agent string. Usage: if ( mobileCheck.smarphone ) { // Code }
var mobileCheck = {
ios: (function(){
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
}()),
android: (function(){
return navigator.userAgent.match(/Android/i);
}()),
blackBerry: (function(){
return navigator.userAgent.match(/BB10|Tablet|Mobile/i);
}()),
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@rriemann
rriemann / create_gif.sh
Created April 17, 2013 14:33
Create an animated gif using ffmpeg, convert (imagemagick) and gifsicle
#!/usr/bin/env sh
rm out*.jpg
rm out*.gif
ffmpeg -y -i 13040065.mp4 -t 1 -filter:v transpose=1,scale=400:-1,deshake,crop=400:400 out%02d.jpg
for file in *.jpg; do
convert $file ${file%.*}.gif
done
gifsicle --delay=5 --colors 256 --loop out*.gif > final.gif
@mjackson
mjackson / color-conversion-algorithms.js
Last active July 24, 2024 13:28
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@s-andringa
s-andringa / Locales.yml
Created September 19, 2012 10:09
Amsrb talk 18 sept - exceptions_app in Rails 3.2
# config/locales/en.yml
en:
exception:
show:
not_found:
title: "Not Found"
description: "The page you were looking for does not exists."
internal_server_error:
title: "Internal Server Error"
@xdite
xdite / gist:3072362
Created July 8, 2012 19:10
deploy/asset.rb
# -*- encoding : utf-8 -*-
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
namespace :deploy do
namespace :assets do
desc <<-DESC
Run the asset precompilation rake task. You can specify the full path \
to the rake executable by setting the rake variable. You can also \