Skip to content

Instantly share code, notes, and snippets.

@rkunboxed
rkunboxed / range_slider_example.dart
Created October 28, 2019 18:40
RangeSlider Example
class RangeSliderExample extends StatefulWidget {
@override
_RangeSliderExampleState createState() => _RangeSliderExampleState();
}
class _RangeSliderExampleState extends State<RangeSliderExample> {
RangeValues _values = RangeValues(0, 10);
@override
Widget build(BuildContext context) {
@rkunboxed
rkunboxed / selectable_text.dart
Last active October 24, 2019 15:31
SelectableText Example
import 'package:flutter/material.dart';
import 'dart:html';
class SelectableTextExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SelectableText(
'Example Text',
onTap: () {
@rkunboxed
rkunboxed / mouse_region.dart
Created October 15, 2019 19:42
Hover Effect on Text
import 'package:flutter/material.dart';
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
void _handleHover(PointerEvent _) {
print('hover on');
}
void _handleHoverOff(PointerEvent _) {
print('hover off');
@rkunboxed
rkunboxed / data-service.js
Created December 15, 2015 17:19 — forked from paul-barry-kenzan/data-service.js
Mocking $resource based service with custom method which is called on Directive compilation
// $resource service being mocked
'use strict';
(function (angular) {
angular
.module('TestModule')
.service('DataService', DataService);
DataService.$inject = ['$resource'];
@rkunboxed
rkunboxed / repeat-complete-directive.js
Created November 16, 2015 20:11
Evaluate Expression After Ng-Repeat Completes
export default function repeatComplete() {
'ngInject';
function link(scope, element, attributes) {
var completeExpression = attributes.repeatComplete;
if (scope.$last) {
scope.$evalAsync(completeExpression);
}
}
@rkunboxed
rkunboxed / sass-pseudo-class-mixin.scss
Created October 5, 2015 16:20
Pseudo Class Mixin for Sass
$black: #000;
@mixin pseudo-class {
&:hover,
&:focus,
&:active,
&.active,
&.selected {
@content;
}
@rkunboxed
rkunboxed / mobile-tap-tracking.html
Last active August 29, 2015 14:27
Drop Down Menu Tap Tracking for Mobile
<!-- This markup is typical of WordPress menus -->
<nav class="nav">
<ul>
<li><a href="">Link One</a>
<ul class="children">
<li><a href="">Child 1</a></li>
<li><a href="">Child 2</a></li>
<li><a href="">Child 3</a></li>
<li><a href="">Child 4</a></li>
</ul>
@rkunboxed
rkunboxed / background-cover-effect.css
Last active August 29, 2015 14:27
CSS Background Cover Effect with JS and Inline Image
.cover-wrapper {
/* height gets set w/JS to allow for a bit of space below the banner no need to set width, it's always as wide as the page */
overflow: hidden;
position: relative;
}
.cover-img {
/* height and width are set w/JS but we use CSS to center */
left: 50%;
position: absolute;
@rkunboxed
rkunboxed / promo-banner.js
Created August 15, 2015 14:48
Header Promo Banner Collapse
$(function() {
var $headerBanner = $('#js-header-banner'),
$body = $('body');
if ($headerBanner.length) {
$body.addClass('banner-on');
// give it a moment before animating the header down
setTimeout(function() {
@rkunboxed
rkunboxed / gist:9115f550c00a6fc00737
Last active August 29, 2015 14:27 — forked from Mithrandir0x/gist:3639232
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"