Skip to content

Instantly share code, notes, and snippets.

View mushu8's full-sized avatar

Alexandre Sagette mushu8

View GitHub Profile
@petelacey
petelacey / Dockerfile
Last active April 7, 2025 01:02
Docker Compose setup for Elixir, Phoenix, and Postgres
FROM elixir:latest
# Install debian packages
RUN apt-get update && \
apt-get install --yes build-essential inotify-tools postgresql-client git && \
apt-get clean
ADD . /app
# Install Phoenix packages
@AaronJamesKing
AaronJamesKing / mixfile_helpers.ex
Created September 23, 2018 21:14
Mixfile helpers
unless Code.ensure_compiled? MyApp.MixfileHelpers do
defmodule MyApp.MixfileHelpers do
@moduledoc """
Defines functions to be shared by individual Mixfiles inside the umbrella project.
Since Mixfiles in an umbrella project often need to stay coordinated, this module has been introduced as a single source of truth.
This module should only be used for configuration that must be shared across applications. If configuration is only incidentally similar across Mixfiles, it should not be defined here.
In order to use these helper functions, run `Code.load_file("path/to/this/module.ex")` inside of a `mix.exs` file. This module's definition is wrapped inside a condition so that it won't be redefined when loaded multiple times.
@yutsengwei
yutsengwei / Angular5-IntroJs.html
Last active June 14, 2019 10:27
Using pure intro.js in Angular 5 [Note]
# 1 . npm install intro.js --save
# 2. @import '~intro.js/minified/introjs.min.css'; to styles.scss
# 3. add to the componenet which you want to show
//add declaration to the top
const IntroJs = require('/pathTo/node_modules/intro.js');
@danielberkompas
danielberkompas / auth.ex
Created March 4, 2017 20:44
An example of how to hack together Ueberauth.Auth structs
defmodule MyApp.Auth do
@moduledoc """
Creates `Ueberauth.Auth` structs from OAuth responses.
This module is an ugly hack which is necessary because `Ueberauth` doesn't provide
the necessary hooks to get such a struct without giving it control of the whole
callback phase. We can't do this in the API because all the mobile app can give us
is the OAuth token.
Most of the code was lifted from Ueberauth, with minor changes as needed.
import UIKit
enum LayoutableButtonVerticalAlignment: String {
case center
case top
case bottom
case unset
}
enum LayoutableButtonHorizontalAlignment: String {
@mushu8
mushu8 / isNilOrEmpty.swift
Last active August 29, 2015 14:27 — forked from kristopherjohnson/isNilOrEmpty.swift
Swift: determine whether optional String, NSString, or collection is nil or empty
import Foundation
/**
Determine whether Optional collection is nil or an empty collection
:param: collection Optional collection
:returns: true if collection is nil or if it is an empty collection, false otherwise
*/
public func isNilOrEmpty<C: CollectionType>(collection: C?) -> C? {
switch collection {
@abcnever
abcnever / Gruntfile.js
Last active June 17, 2016 07:43
Grunt with haml, scss, and coffeescript on ionic framework
/* Gruntfile.js
* Grunt workflow for building AngularJS/Ionic applications.
* Assumption:
* - Gruntfile.js is placed under project root directory
* - there are 4 directories called "www", "coffee", "scss", and "haml" under the project's root directory
* - all the necessary npm packages included with grunt.loadNpmTasks() are installed already
* - %script{:src => '//localhost:35729/livereload.js'} in included at the bottom of your index.haml
*/
'use strict';
@harrisonde
harrisonde / gist:90431ed357cc93e12b51
Last active May 24, 2021 22:01
Deploy Laravel 5 applications on AWS Elastic Beanstalk
# The following script will deploy a Laravel 5 applicaion on AWS Elastic Beanstalk.
# Add to .ebextensions at the root of your application and name your commands file (e.g., commands.config)
# -------------------------------- Commands ------------------------------------
# Use "commands" key to execute commands on the EC2 instance. The commands are
# processed in alphabetical order by name, and they run before the application
# and web server are set up and the application version file is extracted.
# ------------------------------------------------------------------------------
commands:
01updateComposer:
@kristopherjohnson
kristopherjohnson / isNilOrEmpty.swift
Last active December 7, 2021 07:03
Swift: determine whether optional String, NSString, or collection is nil or empty
import Foundation
/**
Determine whether Optional collection is nil or an empty collection
:param: collection Optional collection
:returns: true if collection is nil or if it is an empty collection, false otherwise
*/
public func isNilOrEmpty<C: CollectionType>(collection: C?) -> Bool {
switch collection {
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote