Skip to content

Instantly share code, notes, and snippets.

View matteosister's full-sized avatar
🤗

Matteo Giachino matteosister

🤗
View GitHub Profile
@graceavery
graceavery / harryPotterAliases
Last active May 10, 2023 02:51
bash aliases for Harry Potter enthusiasts
alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv
alias sonorus='set -v'
alias quietus='set +v'
@fxn
fxn / init.coffee
Created January 31, 2016 10:59
Easy pipeline entry in Atom (Elixir)
# ~/.atom/init.coffee
atom.commands.add 'atom-text-editor', 'elixir:pipeline': ->
editor = atom.workspace.getActiveTextEditor()
editor.moveToEndOfLine()
editor.insertNewline()
editor.insertText("|> ")
@henrik
henrik / say_when.exs
Last active September 7, 2016 09:03
Example of using "guard clauses" in your own code with Elixir macros. Inspired by `plug :foo when action in [:create, :update]`. This implementation accepts any types of conditions, not just the subset allowed in actual guard clauses. But also see https://gist.github.com/henrik/68f136f9916165e0defb for an implementation with real guard clauses.
defmodule Lab do
defmacro say({:when, _, [message, condition]}) do
{result, _} = Code.eval_quoted(condition)
if result do
quote do
IO.puts unquote(message)
end
end
end
@joshrieken
joshrieken / Gulpfile.js
Last active July 10, 2019 15:33
Replacing Brunch with Gulp in Phoenix
// Contains support for: SASS/SCSS, concatenation, and minification for JS and CSS
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var concat = require('gulp-concat');
var compress = require('gulp-yuicompressor');
@joakimk
joakimk / README.md
Last active January 1, 2022 23:21
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.

@jakzal
jakzal / vm.sh
Last active October 1, 2015 20:24
Run commands on a Vagrant VM
#!/usr/bin/env bash
VM_PROJECT_DIR="/home/vagrant/project"
COMMAND="$1"
shift
run() {
vagrant ssh -c "cd $VM_PROJECT_DIR ; $*"
}
@Problematic
Problematic / ComboBreaker.js
Created November 9, 2012 21:15
Simple key-combo detector. Uses jQuery
/*jslint browser: true, plusplus: true */
(function ($) {
"use strict";
var ComboBreaker = function (combo, callback, options) {
var index = 0, timeout = null;
if (!(this instanceof ComboBreaker)) { return new ComboBreaker(combo, callback, options); }
this.options = $.extend({}, {
@havvg
havvg / JasmineHandler.php
Created October 31, 2012 16:57
Symfony2 + Jasmine = JasmineHandler
<?php
namespace Ormigo\Tests;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;
class JasmineHandler
{
protected $templating;
@botimer
botimer / yesno.rb
Created June 7, 2012 19:56
Handy yes/no prompt for little ruby scripts
# This is a reasonably well-behaved helper for command-line scripts needing to ask a simple yes/no question.
# It optionally accepts a prompt and a default answer that will be returned on enter keypress.
# It keeps asking and echoes the answer on the same line until it gets y/n/Y/N or enter.
# I tried to get Highline to behave like this directly, but even though it's sophisticated, I didn't like the result.
# This isn't especially elegant, but it is straightforward and gets the job done.
require 'highline/import'
def yesno(prompt = 'Continue?', default = true)
a = ''
s = default ? '[Y/n]' : '[y/N]'