Skip to content

Instantly share code, notes, and snippets.

View darrylhebbes's full-sized avatar

Darryl Hebbes darrylhebbes

  • Berlin, Germany
View GitHub Profile
const { withStateHandlers } = Recompose;
const Counter = ({ count, increment, decrement }) =>
<div>
Count: {count}
<div>
<button onClick={increment}>+</button>
<button onClick={decrement}>-</button>
</div>
</div>;
@darrylhebbes
darrylhebbes / Ctrlp-rg.vim
Created September 18, 2017 08:31
Using ripgrep with VIM CtrlP plugin
" If on Mac run:
" brew install ripgrep
" Install CtrlP of course
" Plug 'ctrlpvim/ctrlp.vim'
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching = 0
else
@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.";
}
@darrylhebbes
darrylhebbes / init.el
Created April 29, 2016 20:36
Robert Adesam - Emacs init file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Emacs init file by
;;; Robert Adesam, [email protected]
;;; 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 / 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 <[email protected]>
;; Version: 1.1
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
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 / 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">
@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 / 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 / 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))))