Skip to content

Instantly share code, notes, and snippets.

View vmoravec's full-sized avatar

Vladimir Moravec vmoravec

View GitHub Profile
defmodule Sync.Middleware.RateLimit do
@defaults [
delay: 2000,
max_retries: 5
]
def call(env, next, opts) do
opts = opts || []
delay = Keyword.get(opts, :delay, @defaults[:delay])
max_retries = Keyword.get(opts, :max_retries, @defaults[:max_retries])
@jeffweiss
jeffweiss / eldap.exs
Created November 9, 2015 19:30
sample of using eldap from elixir
:application.ensure_all_started(:ssl)
{:ok, handle} = :eldap.open(['ldap.example.com'], [{:port, 636}, {:ssl, true}])
authenticated =
:ok == :eldap.simple_bind(handle,
'uid=jeff,ou=users,dc=example,dc=com',
'notmyrealpassword')
{:ok, {:eldap_search_result, list_of_entries, _}} =
@chrismcg
chrismcg / Brocfile.js
Created July 4, 2015 21:01
Reference files for my ember-cli / Phoenix blog post
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var ES6Modules = require('broccoli-es6modules');
var esTranspiler = require('broccoli-babel-transpiler');
var mergeTrees = require('broccoli-merge-trees');
var app = new EmberApp();
// Use `app.import` to add additional libraries to the generated
@cloudbring
cloudbring / README.md
Last active May 1, 2017 02:42
Building an Phoenix / Elixir Web App in June 2015
@mbbx6spp
mbbx6spp / README.md
Last active October 22, 2024 13:13
Gerrit vs Github for code review and codebase management

Gerrit vs Github: for code review and codebase management

Sure, Github wins on the UI. Hands down. But, despite my initial annoyance with Gerrit when I first started using it almost a year ago, I am now a convert. Fully. Let me tell you why.

Note: This is an opinionated (on purpose) piece. I assume your preferences are like mine on certain ideas, such as:

  • Fast-forward submits to the target branch are better than allowing merge commits to the target branch. The reason I personally prefer this is that, even if a non-conflicting merge to the target branch is possible, the fact that the review/pull request is not up to date with the latest on the target branch means feature branch test suite runs in the CI pipeline reporting on the review/PR may not be accurate. Another minor point is that forced merge commits are annoying as fuck (opinion) and clutter up Git log histories unnecessarily and I prefer clean histories.
  • Atomic/related changes all in one commit is something worth striving for. Having your dev
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active September 16, 2024 18:47
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@ctalkington
ctalkington / Gemfile
Last active October 26, 2024 04:10
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"
@tbranyen
tbranyen / backbone.collectioncache.js
Created June 4, 2012 06:37
Backbone.Collection caching by URL
/*!
* backbone.collectioncache.js v0.0.2
* Copyright 2012, Tim Branyen (@tbranyen)
* backbone.collectioncache.js may be freely distributed under the MIT license.
*/
(function(window) {
"use strict";
// Dependencies
@jcromartie
jcromartie / spark.rb
Created November 15, 2011 13:37
Sparklines in Ruby
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# prints a sparkline in the terminal using the supplied list of numbers
# examples:
# spark.rb 10 20 30 100 90 80
# spark.rb 1 2 0.4 0.1 1.3 0.7
@ticks = %w[▁ ▂ ▃ ▄ ▅ ▆ ▇]
values = ARGV.map { |x| x.to_f }