Skip to content

Instantly share code, notes, and snippets.

View DarrylD's full-sized avatar

Darryl D. DarrylD

View GitHub Profile
DarrylD / zen.1h.js
Created November 6, 2017 16:20
Bitbar plugin to give zen like quotes
var quotes = [
"Whatever you are, be a good one.\n-Abraham Lincoln",
"If you dream it, you can do it.\n-Walt Disney",
"Never, never, never give up.\n-Winston Churchill",
"Don’t wait. The time will never be just right.\n-Napoleon Hill",
"If not us, who? If not now, when?\n-John F. Kennedy",
"Everything you can imagine is real.\n-Pablo Picasso",
"I can, therefore I am.\n-Simone Weil",
DarrylD / ChatScroller.js
Created September 8, 2016 16:06
A chat scroller for react
import React from 'react'
<ChatScroller ref="chatScroller">
to force move the containt to the bottom:
DarrylD / directive.js
Created February 14, 2015 22:02
ionic slide box dynamic height - fixes the issue where the slide boxes aren't taking up the full height of the device
app.directive('dynamicHeight', function() {
return {
require: ['^ionSlideBox'],
link: function(scope, elem, attrs, slider) {
scope.$watch(function() {
return slider[0].__slider.selected();
}, function(val) {
//getting the heigh of the container that has the height of the viewport
var newHeight = window.getComputedStyle(elem.parent()[0], null).getPropertyValue("height");
if (newHeight) {
DarrylD / app.js
Created May 2, 2014 16:17
express.js, simple dynamic route loading
//all of your express config stuff
var express = require('express')
, app = express()
//load api routes (app of the files from /api)
//rest of your expressjs stuff
DarrylD / view-constructor-override.js
Last active August 29, 2015 13:56
Simple override of a Backbone class, View in this case. Can be applied to modal, collection, etc...
Backbone.View = (function(View) {
// Define the new constructor
Backbone.View = function(attributes, options) {
// New constructor stuff here...
// Call default constructor
View.apply(this, arguments);
DarrylD / koa-example.js
Last active January 3, 2016 09:29
Made a lengthier example on Koa's flow and how it uses generators. This is just demonstrating how the middleware stacks and uses yield opposed to using callbacks like in ExpressJS.
//Koajs example
var koa = require('koa');
var app = koa();
//Middleware cascading
app.use(function * (next) {
//Some stuff will happen here first
console.log('FIRST execution')
DarrylD / paste-image.html
Created November 7, 2013 16:09
Demo of simple way to paste ( ctrl+v ) from clipboard.
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<title>Paste image from clipboard in Chrome</title>
<script src=""></script>
//plugin for pasting from
(function($) {
// plugin by STRd6
DarrylD / stickyheader.js
Last active December 27, 2015 12:09
Simple fixed header after trigger point
var triggerElement = $(".container") //element to he used to trigger the fixed header
, header = $(".header") //element of header
, stickyClass = "stickit" // class to be used to give the fixed header a fixed position
var offset = 0,sticky = false,top = $(window).scrollTop();
if (triggerElement.offset().top < top) {
sticky = true;