Skip to content

Instantly share code, notes, and snippets.

View dcousineau's full-sized avatar
:shipit:
WORKING HARD OR HARDLY WORKING AHAHAHAH

Daniel Cousineau dcousineau

:shipit:
WORKING HARD OR HARDLY WORKING AHAHAHAH
View GitHub Profile
@dcousineau
dcousineau / raphael.centroid.js
Created November 15, 2011 17:16
RaphaëlJs approximate centroid extension, should work with arbitrary paths.
Raphael.el.getCentroid = function() {
var centroid = { x: 0, y: 0 }
, area = 0
, length = this.getTotalLength()
, lengthSegment = length / 100.00;
for (var i = 0; i < length; i += lengthSegment) {
var curr = this.getPointAtLength(i)
, next = this.getPointAtLength(i + lengthSegment);
@dcousineau
dcousineau / gist:1927114
Created February 27, 2012 21:05
Care to sort an Object with Underscore anyone? I'm crazy
_.extend(request.params, {
AWSAccessKeyId: this.key
, SignatureVersion: 2
, SignatureMethod: 'HmacSHA256'
, Version: request.opts.version || '2009-04-15'
, Timestamp: new Date().toISOString()
});
var sortedParams = _(request.params).chain()
.map(function(v, k) { return [k,v]; })
-bash: /home/vagrant/.bash_aliases: line 5: syntax error near unexpected token `$'{\r''
'bash: /home/vagrant/.bash_aliases: line 5: `__has_parent_dir () {
{# Sourced From: https://github.com/braincrafted/bootstrap-bundle/blob/develop/Resources/views/Form/form_div_layout.html.twig #}
{# Widgets #}
{% block form_widget %}
{% spaceless %}
{% if compound %}
{{ block('form_widget_compound') }}
{% else %}
{{ block('form_widget_simple') }}
<?php
var_dump( array_combine(range(1,12), array_map(function($i) { return date('M', mktime(1,0,0,$i,1,1970)); }, range(1,12))) );
/**
array(12) {
[1] =>
string(3) "Jan"
[2] =>
string(3) "Feb"
[3] =>
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/domain/my_private_repo.git"
}
],
"require": {
"php": ">=5.4.0",
"robmorgan/phinx": "dev-master",
@dcousineau
dcousineau / gist:6789144
Created October 2, 2013 04:25
My Pad Thai Sauce

Note: These are rough estimates of proportion going off of memory, so adjust to taste. The sauce should be tangy and spicy with a tiny bit of saltiness and sweetness

Ingredients

  • 1tbsp Oyster sauce
  • 2tbsp White/rice vinegar
  • 1tbsp Fish sauce
  • 3tsp Chili paste
  • 3tsp Brown Sugar
@dcousineau
dcousineau / gist:7101607
Last active December 26, 2015 05:38
Comma First indentation example
var test = 1
, another = 3
, yetanother = 4
, array = [
'member'
, 'element'
, 'item'
]
, variable = 5;
@dcousineau
dcousineau / afp.conf
Created October 29, 2013 00:17
Configuration files for my local ubuntu server for reference. Most tutorials I found were for netatalk 2.x, this is the configuration for 3.x. FILE LOCATIONS: /etc/afp.conf /etc/avahi/services/afpd.service This serves up the file systems via AFP. I am unsure how to do native time machine identification using smb3 at the moment, but to be honest …
;
; Netatalk 3.x configuration file
;
[Global]
; Global server settings
; [Homes]
; basedir regex = /home
#drop_overlay {
display:none;
background: rgba(0,0,0,0.75);
color: #fff;
}
#drop_overlay span {
font-size: 35px;
text-align: center;