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 / 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 / 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 / t199
Created August 28, 2014 14:10
outputsvg
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="226.8" height="839.1" xml:space="preserve" text-rendering="geometricPrecision" shape-rendering="crispEdges" image-rendering="optimizeQuality"><desc>67109035 / T199</desc><defs><clipPath id="clipPath0"><rect x="24" y="66" width="180.8" height="382.7"/></clipPath><clipPath id="clipPath1"><rect x="24" y="448" width="180.8" height="384"/></clipPath></defs>
<svg id="0"><g style="clip-path: url(#clipPath0);"><g style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: source-over; opacity: 0;" transform="translate(0 2.842170943040401e-14)">
<path d="M 72.297 447.9 c 0.006 0.138 0.024 0.272 0.024 0.411 v 6.742 c 0 5.668 -5.341 10.279 -11.907 10.279 c -6.564 0 -11.905 -4.6
@darrylhebbes
darrylhebbes / Recruiting.md
Created July 2, 2014 14:14 — forked from ProLoser/Recruiting.md
#Post: Dear Recruiter or Hopeful Employer

Dear Recruiter or Hopeful Employer,

I'm going to be frank.

I don't have the time or energy to have a phone chat with every recruiter who contacts me. If you want to know about me, such as if I'm worth pursuing, I can answer any questions you have via email. I will only talk on the phone to employees of the prospective company.

That said, here's the answer to most questions:

  • Are you looking for a new job?
    Not really, unless it meets my specific criteria.
@darrylhebbes
darrylhebbes / cookiequirk.js
Last active August 29, 2015 14:01
AngularJS Cookie factory based on quirksmode article http://www.quirksmode.org/js/cookies.html
'use strict';
angular.module('CookieCompany', [])
.factory('Bakery', function ($document) {
return {
create : function(name, ingredients, duration) {
if (duration) {
var date = new Date();
date.setTime(date.getTime()+(duration*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
@darrylhebbes
darrylhebbes / gist:11249982
Created April 24, 2014 10:43
ng-model selected item
<select name="rawProductID" name="rawProductID" ng-model="entity.rawProduct.id">
<option value="-">choose</option>
<option ng-repeat="product in products" value="{{product.id}}">{{product.name}} / {{product.id}}</option>
</select>
{
"apiVersion": "0.0.3",
"swaggerVersion": "1.2",
"basePath": "http://example.com/api",
"resourcePath": "/",
"produces": ["application/json"],
"apis": [
{
"path": "/image/{filename}",
"operations": [{
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Merge SVG paths" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<svg>
<path id="Line1" d="M50,50
class BaseCtrl
constructor: ->
console.log("All your base are belong to us!")
toJson: (item) ->
JSON.stringify(item)
class TodoCtrl extends BaseCtrl
constructor: (@$scope) ->
super
@darrylhebbes
darrylhebbes / rsync-app.sh
Created April 3, 2013 21:12
A script to pass password to SSH Rsync session, without using SSH Keys. NOTE: this is not a wise solution but useful in certain situations. Usage example 1: "./rsync-app.sh B" will spawn the Rsync in the second block, "./rsync-app.sh ABC" will run all three.
#!/usr/bin/expect -f
set MachineName "Macintosh HD"
set MachineUserProfile "computerprofile"
set ProjectPath "htdocs/yourlocalprojectname"
set RemoteLogin "[email protected]"
set RemoteProjectPath "/htdocs/myproject"
set PASSPH "theSSHpassword"