Skip to content

Instantly share code, notes, and snippets.

Reda Lemeden kaishin

Block or report user

Report or block kaishin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kaishin
kaishin / SassMeister-input.scss
Created Oct 27, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.6)
// Compass (v1.0.1)
// Bourbon (v4.0.2)
// Neat (v1.6.0)
// ----
@import "bourbon/bourbon";
@import "neat/neat";
@kaishin
kaishin / SassMeister-input.scss
Last active Aug 29, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.6)
// Compass (v1.0.1)
// Bourbon (v4.0.2)
// Neat (v1.6.0)
// ----
@import "bourbon/bourbon";
$grid-columns: 6;
@import "neat/neat";
View selector-helpers.scss
@function attr-ends-with-string($attr, $string) {
@return "[#{$attr}$=#{$string}]";
}
@kaishin
kaishin / SassMeister-input-HTML.html
Created Jun 2, 2014
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<div class="container">
<section>Section 1</section>
<section>Section 2</section>
</div>
@kaishin
kaishin / dataSize.m
Created Jun 1, 2014
Log NSData size in a human-readable format.
View dataSize.m
NSLog(@"%@",[NSByteCountFormatter stringFromByteCount:data.length countStyle:NSByteCountFormatterCountStyleFile]);
@kaishin
kaishin / tabs.coffee
Last active Aug 29, 2015
Accordion Tabs
View tabs.coffee
ACTIVE_CLASS = 'js-is-active'
$tabs = $("[data-role='tab']")
$toggles = $tabs.find("[data-role='link']")
$toggles.on 'click', (event) ->
event.preventDefault()
$toggle = $(@)
$tab = $toggle.closest($tabs)
unless $tab.hasClass(ACTIVE_CLASS)
$tabs.removeClass(ACTIVE_CLASS)
@kaishin
kaishin / NSColor+isLight.h
Last active Sep 25, 2019
Programmatically determine the perceived lightness of a color. More details on: http://robots.thoughtbot.com/closer-look-color-lightness + Online tool: http://thoughtbot.github.io/color-lightness-test/
View NSColor+isLight.h
#import <Cocoa/Cocoa.h>
@interface NSColor (isLight)
- (BOOL)isLight;
@end
@kaishin
kaishin / UIColor+isLight.h
Last active Jun 16, 2016
Get whether a color is dark or light using either luminance or lightness.
View UIColor+isLight.h
#import <UIKit/UIKit.h>
@interface UIColor (isLight)
- (CGFloat)lightness;
- (CGFloat)perceivedLightness;
- (CGFloat)perceivedLightnessW3C;
- (BOOL)isLight;
- (BOOL)isPerceivedLightW3C;
- (BOOL)isPerceivedLight;
@kaishin
kaishin / threadCheck.m
Last active Dec 27, 2015
My concurrency homie. Sprinkle some of it inside and around your blocks and concurrency will never come back to haunt you again.
View threadCheck.m
NSLog([NSThread currentThread] == [NSThread mainThread] ? @"❇️ Main thread, it is." : @"♒️ Doesn't look like main thread around here...");
@kaishin
kaishin / gray-with-lightness.scss
Created Oct 24, 2013
Return a gray color with a level of lightness.
View gray-with-lightness.scss
@function gray-with-lightness($level: 0.5) {
@if $level > 1 {
$level: 1.0;
} @else if $level < 0 {
$level: 0.0;
}
@return lighten(#000, percentage($level));
}
You can’t perform that action at this time.