Skip to content

Instantly share code, notes, and snippets.

💭
daydreaming

Darryl Dexter DarrylD

💭
daydreaming
Block or report user

Report or block DarrylD

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
@DarrylD
DarrylD / paste-image.html
Created Nov 7, 2013
Demo of simple way to paste ( ctrl+v ) from clipboard.
View paste-image.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Paste image from clipboard in Chrome</title>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script>
//plugin for pasting from https://gist.github.com/STRd6/5286415
(function($) {
// plugin by STRd6
@DarrylD
DarrylD / app.js
Created May 2, 2014
express.js, simple dynamic route loading
View app.js
//all of your express config stuff
var express = require('express')
, app = express()
//load api routes (app of the files from /api)
require('./api').boot(app)
//rest of your expressjs stuff
@DarrylD
DarrylD / zen.1h.js
Created Nov 6, 2017
Bitbar plugin to give zen like quotes
View zen.1h.js
#!/usr/local/bin/node
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
DarrylD / directive.js
Created Feb 14, 2015
ionic slide box dynamic height - fixes the issue where the slide boxes aren't taking up the full height of the device
View directive.js
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
DarrylD / ChatScroller.js
Created Sep 8, 2016
A chat scroller for react
View ChatScroller.js
import React from 'react'
/**
example:
<ChatScroller ref="chatScroller">
{this.renderStuff()}
</ChatScroller>
to force move the containt to the bottom:
@DarrylD
DarrylD / koa-example.js
Last active Jan 3, 2016
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. https://github.com/koajs/koa
View koa-example.js
//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
DarrylD / stickyheader.js
Last active Dec 27, 2015
Simple fixed header after trigger point
View stickyheader.js
(function(){
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
$(window).scroll(function(){
var offset = 0,sticky = false,top = $(window).scrollTop();
if (triggerElement.offset().top < top) {
header.addClass(stickyClass)
sticky = true;
@DarrylD
DarrylD / view-constructor-override.js
Last active Aug 29, 2015
Simple override of a Backbone class, View in this case. Can be applied to modal, collection, etc...
View view-constructor-override.js
Backbone.View = (function(View) {
// Define the new constructor
Backbone.View = function(attributes, options) {
// New constructor stuff here...
// Call default constructor
View.apply(this, arguments);
You can’t perform that action at this time.