Skip to content

Instantly share code, notes, and snippets.

View darrylhebbes's full-sized avatar

Darryl Hebbes darrylhebbes

  • Berlin, Germany
View GitHub Profile
@darrylhebbes
darrylhebbes / index.html
Created August 30, 2014 12:07
#Javascript ng-online Checking online status in AngularJS app, source http://jsbin.com/hayopo/1
<meta name="description" content="Checking online status in AngularJS app" />
<title>ng-online</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.14/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap-tpls.min.js"></script>
<script src="main.js"></script>
<body ng-app="App">
<div ng-controller="AppController">
@darrylhebbes
darrylhebbes / throttle.js
Last active August 29, 2015 14:11
Throttle Function
function callback () {
console.count("Throttled");
}
window.addEventListener("resize", throttle( callback, 300 ));
function throttle (callback, limit) {
var wait = false; // Initially, we're not waiting
return function () { // We return a throttled function
@darrylhebbes
darrylhebbes / pathToEmacs.el
Created January 31, 2015 15:14
#Emacs Ensure the GUI Emacs always sees the same $PATH that I get inside a shell
;; credit SanityInc : http://stackoverflow.com/a/6415812
(defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell (replace-regexp-in-string
"[ \t\n]*$"
""
(shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
(setenv "PATH" path-from-shell)
(setq eshell-path-env path-from-shell) ; for eshell users
(setq exec-path (split-string path-from-shell path-separator))))
@darrylhebbes
darrylhebbes / delay_fb.js
Created March 9, 2015 09:31
#Javascript : Delay Facebook init
.run(function($rootScope, $location, SlidebeanUser) {
// 1) AngularJS app is now running
// 2) Initialize Parse and set the current user to the $rootScope
Parse.initialize("parse app", "parse credentials");
$rootScope.sessionUser = SlidebeanUser.current();
// 3) Finally, init Facebook
@darrylhebbes
darrylhebbes / hydra.el
Last active December 19, 2022 15:26 — forked from joedicastro/hydra.el
#Emacs Hydras for buffers and window manipulation
(defhydra hydra-buffers (:color blue :hint nil)
"
╭─────────┐
Move to Window Switch Do │ Buffers │
╭────────────────────────────────────────────────────────────────────┴─────────╯
^_k_^ [_b_] switch (ido) [_d_] kill the buffer
^^↑^^ [_i_] ibuffer [_r_] toggle read-only mode
_h_ ← → _l_ [_a_] alternate [_u_] revert buffer changes
^^↓^^ [_s_] switch (helm) [_w_] save buffer
^_j_^
@darrylhebbes
darrylhebbes / index.html
Created April 8, 2015 07:51
#Javascript: Checking online status in AngularJS app
<meta name="description" content="Checking online status in AngularJS app" />
<title>ng-online</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.14/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap-tpls.min.js"></script>
<script src="main.js"></script>
<body ng-app="App">
<div ng-controller="AppController">
var Cano = (function() {
var thisURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
var pathArray = window.location.pathname.split('/');
var pathLength = pathArray.length;
function Cano(n) {
if (pathLength > 3){
$('head').append('<link rel="canonical" href="'+"http:\/\/designskins.com\/de\/design-folien\/handy-huelle"+'"/>');
} else{
$('head').append('<link rel="canonical" href="'+thisURL+'"/>');
@darrylhebbes
darrylhebbes / marker-visit.el
Created April 29, 2016 20:33
marker-visit.el --- navigate through a buffer's marks in order in Emacs
;;; marker-visit.el --- navigate through a buffer's marks in order
;; Copyright (C) 2001 Benjamin Rutt
;;
;; Maintainer: Benjamin Rutt <brutt@bloomington.in.us>
;; Version: 1.1
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
@darrylhebbes
darrylhebbes / init.el
Created April 29, 2016 20:36
Robert Adesam - Emacs init file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Emacs init file by
;;; Robert Adesam, robert@adesam.se
;;; http://www.adesam.se/robert/
;;;
;;; This is my init file for Emacs 22, 23, and 24 on MacOSX, Linux,
;;; and Windows/Cygwin
;;;
;;; TODO: Solaris
@darrylhebbes
darrylhebbes / ReactInputValidate.jsx
Created May 12, 2016 15:03
React Input Validate
/** @jsx React.DOM */
var Email = Backbone.Model.extend({
defaults: {
email: ""
},
validate: function (attrs) {
if (!/^.+@.+\..+$/.test(attrs.email)) {
return "'" + attrs.email + "' is not a valid email.";
}