Skip to content

Instantly share code, notes, and snippets.

View DAddYE's full-sized avatar

Davide D'Agostino DAddYE

  • Uber
  • San Francisco
View GitHub Profile
@DAddYE
DAddYE / freaking_npm.sh
Created January 30, 2014 21:36
Fix the freaking npm update -g
#!/bin/bash
for man in 1 3 5 7; do
ln -sf /usr/local/lib/node_modules/npm/man/man${man}/* /usr/local/share/man/man${man}
done
ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
npm update npm -g
@DAddYE
DAddYE / gist:8721292
Created January 30, 2014 22:22 — forked from tmm1/gist:8393897
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.
class HTTPRouter
self()
self.routes = { }
end
add(verb = String, path = String, func = Function)
self.routes[#self.routes + 1] = Route(verb, path, func)
end
match(verb, path)
for i=1, #self.routes do
m, q = self.routes[i].match(verb, path)

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.


1. Introduction

  • Haskell is a functional programming language.
# vim: ft=ruby
PLUGINS = %w[
pry-rails
pry-doc
pry-git
pry-stack_explorer
pry-remote
pry-debugger
hirb
// Credits: https://news.ycombinator.com/item?id=7735973
pc, _, line, _ := runtime.Caller(1)
name := runtime.FuncForPC(pc).Name()

Partition hard drives

Use cfdisk command to create partitions. If you have 1 disk only, you need (at least) 2 partitions:

  1. Boot (/dev/sda1)
  2. Root (/dev/sda2)

Format hard drives

mkfs.ext4 /dev/sda1

@DAddYE
DAddYE / designer.html
Created July 27, 2014 09:02
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">
@DAddYE
DAddYE / designer.html
Created August 11, 2014 06:49
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">
@DAddYE
DAddYE / chan.go
Created September 13, 2014 08:35
Infinitely Buffered Channel
/*
This is an infinitely buffered channel.
*/
package main
import (
"fmt"
"sync"
"time"
)