Skip to content

Instantly share code, notes, and snippets.

View philipgiuliani's full-sized avatar
:octocat:

Philip Giuliani philipgiuliani

:octocat:
View GitHub Profile
@slashdotdash
slashdotdash / CloudWatchReporter.ex
Last active July 8, 2019 11:59
AWS CloudWatch reporter for Commanded telemetry.
defmodule CloudWatchReporter do
use GenServer
require Logger
alias ExAws.Cloudwatch
@namespace "My/App"
def start_link(args) do
@chrismccord
chrismccord / upgrade.md
Last active April 7, 2023 12:03
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

@philipgiuliani
philipgiuliani / gist:7ed2bd4d5993784c9808738df7265323
Created November 30, 2016 19:48 — forked from jansanchez/gist:ce5b0ca1c5e538f4b266
How to install NVIDIA video drivers in Elementary OS
@techgaun
techgaun / erlang-elixir-on-amazon-linux.md
Last active November 21, 2023 03:09
Running elixir 1.8.1 on amazon linux

Script

#!/bin/bash

yum install ncurses-devel openssl-devel -y
yum groupinstall "Development Tools" -y

cd /tmp
wget "http://erlang.org/download/otp_src_21.3.tar.gz" -O otp21.tar.gz
@philipgiuliani
philipgiuliani / Cache.js
Created July 28, 2015 12:22
Cache helper which uses the localStorage. Promise polyfill maybe required!
window.Cache = {
/**
* Fetch a object from the cache, if it does not exist, create it.
*
* @param {string} key Key to find / store the item in the localStorage.
* @param {function} [fetchPromise] Promise to fetch new data
*
* @example
* Cache.fetch("result", (resolve, reject) => {
* resolve(5 * 10);
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@gabrielemariotti
gabrielemariotti / README.md
Last active March 9, 2023 06:02
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@benvium
benvium / retrofit-custom-error-handling.java
Created August 29, 2014 19:45
Fairly simply Retrofit custom error handling example. Is set up so that you don't need to do much work in the 'failure' handler of a retrofit call to get the user-visible error message to show. Works on all endpoints. There's lots of exception handling as our server folks like to keep us on our toes by sending all kinds of random stuff..!
// on error the server sends JSON
/*
{ "error": { "data": { "message":"A thing went wrong" } } }
*/
// create model classes..
public class ErrorResponse {
Error error;
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@mattvh
mattvh / favicon.rb
Last active September 4, 2020 12:13
Discovering and saving favicons with Ruby
# by Matt Harzewski
# Read more: http://www.webmaster-source.com/2013/09/25/finding-a-websites-favicon-with-ruby/
require "httparty"
require "nokogiri"
require "base64"
class Favicon