Skip to content

Instantly share code, notes, and snippets.

@Pandahisham
Pandahisham / SASS_Color_Contrast.md
Created September 24, 2016 15:31 — forked from voxpelli/SASS_Color_Contrast.md
Pure SASS script for calculating contrast ratios of colors. An adaption of Lea Verou's contrast-ratio javascript.

Pure SASS-adaption of Lea Verou's contrast-ratio javascript. Can be useful when eg. generating colored buttons from a single supplied color as you can then check which out of a couple of text colors would give the best contrast.

This script currently lacks the support for alpha-transparency that Lea supports in her script though.

In addition to the color-contrast adaption there's also some math methods that were needed to be able to calculate the exponent of a number and especially so when the exponent is a decimal number. A 2.4 exponent is used to calculate the luminance of a color and calculating such a thing is not something that SASS supports out of the box and not something I found a good pure-SASS script for calculating and I much prefer pure-SASS over ruby extensions. The math methods might perhaps be unecessary though if you're running Compass or similar as they may provide compatible math methods themselves.

Normal usage: `color: pick_best_color(#f00

@Pandahisham
Pandahisham / dev setup.md
Last active September 2, 2016 10:46
windows dev environment setup
  • download sublimetext
  • download sublimetext plugins
    • advanced new file
    • auto filename
    • text pastry
    • tabr
    • mardown editing
    • cdnjs
    • clickable url
  • nav panel
@Pandahisham
Pandahisham / OpenWithSublimeText3.bat
Created July 3, 2016 14:30 — forked from cstewart90/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 10)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@Pandahisham
Pandahisham / smooth.css
Created March 28, 2016 16:16 — forked from alexburner/smooth.css
Medium typography hacks
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-moz-font-feature-settings: "liga" on;
@Pandahisham
Pandahisham / textcase_chaner.ahk
Created December 4, 2015 13:35
cycle changing
;-Change Text Case-----------------------------------------
cycleNumber := 1
#IfWinNotActive ahk_class XLMAIN
^t::
If (cycleNumber==1)
{
ConvertUpper()
cycleNumber:= 2
@Pandahisham
Pandahisham / mixins.styl
Created December 4, 2015 12:16 — forked from russweas/mixins.styl
Stylus BEM mixins
// Mixins.styl
has($name)
/&__{$name}
{block}
variant($name)
/&--{$name}
{block}
@Pandahisham
Pandahisham / gist:b877fc704837a395404e
Created November 8, 2015 15:43 — forked from Tomalak/gist:15824
VBScript drag&drop mass file renaming
set fso = CreateObject("Scripting.FilesystemObject")
set shell = CreateObject("Wscript.Shell")
set args = wscript.Arguments
set re = New RegExp
set TodoList = CreateObject("Scripting.Dictionary")
appName = "File Rename Tool"
myname = wscript.scriptfullname
mypath = left(myname, instrrev(myname, "\") -1)
regkey = "HKCU\Software\vbsReplaceTool\"
@Pandahisham
Pandahisham / hosted_example.txt
Created November 3, 2015 16:52 — forked from makevoid/hosted_example.txt
JQuery DOM HighLighter (it's a basic "Inspect element" simple implementation to mimic what webkit inspector and firebug do)
http://uploads.makevoid.com/jquery_dom_highlighter.html
@Pandahisham
Pandahisham / aot.ahk
Created October 7, 2015 14:51 — forked from tom-spalding/aot.ahk
A basic Autohotkey script to make windows always on top..
; Always on Top
; https://gist.github.com/digitalvapor
; press CTRL+Space to toggle a window to always on top.
; Winset: http://ahkscript.org/docs/commands/WinSet.htm
; WinSet, Attribute, Value [, WinTitle, WinText, ExcludeTitle, ExcludeText]
; If you are going to make another window on-top that was 'ran as admin', then you'll want to run your autohotkey script as admin too.
^SPACE:: Winset, AlwaysOnTop, Toggle, A