Skip to content

Instantly share code, notes, and snippets.

@kokarn
kokarn / doesnt-work.ts
Last active October 18, 2022 17:55
FUCKING typescript
// Errors on line 12
// Operator '!==' cannot be applied to types 'boolean' and 'View'.
class Server {
currentView: View;
manualView: ManualView;
private showViewCommand(view: View, data?: string) {
let oldView = this.currentView;
this.currentView = view;
var loadData : function( urlEndpoint, callback ){
var fullPath = this.baseUrl + urlEndpoint,
encodedString = utf8ToBase64( fullPath ),
$deferred;
if( typeof fbiApiHelper.cacheData[ encodedString ] !== 'undefined' ){
if( typeof fbiApiHelper.cacheData[ encodedString ].readyState !== 'undefined' ){
// XHR object, do as ususal
fbiApiHelper.cacheData[ encodedString ].done( function( response ){
callback.call( this, response );
@kokarn
kokarn / mixin.less
Created December 11, 2014 13:53
LESS mixin for using nth-child on IE7 & IE8
.clear-nth( @selector, @n, @currentSelector: '', @i: 1 ) when ( mod( @i, @n + 1 ) = 0 ) and ( @i < 100 ){
@updatedSelector: e( '@{currentSelector} + @{selector}' );
@{updatedSelector} {
clear: both;
}
.clear-nth( @selector, @n, @updatedSelector, ( @i + 1 ) );
}
@kokarn
kokarn / fluid.scss
Last active December 13, 2015 19:18
Custom fluid on non-fluid stuff. Example will loop from max-width: 1003px to max-width: 800px calculating the current number for the width on each step.
@mixin customFluid($start, $end, $startValue, $endValue) {
$diff: $end - $start;
$valueDiff: $endValue - $startValue;
@for $i from 1 through $diff {
$currentStep: $diff - $i;
$currentValue: $endValue - ( $valueDiff / $diff ) * $currentStep;
@media (max-width: 800px + $currentStep) {
#start-page {
width: $currentValue;
}
@kokarn
kokarn / filters.svg
Last active December 11, 2015 22:58
CSS3 Grayscale (kinda)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.