Skip to content

Instantly share code, notes, and snippets.

View PabloVallejo's full-sized avatar

Pablo Vallejo PabloVallejo

View GitHub Profile
@oivoodoo
oivoodoo / Dockerfile
Created November 23, 2016 08:09
Dockerize Elixir app
FROM trenpixster/elixir
WORKDIR /app
ADD http://s3.amazonaws.com/s3.hex.pm/installs/1.1.0/hex-0.14.0.ez /tmp/
RUN mix archive.install --force /tmp/hex-0.14.0.ez
@felipe3dfx
felipe3dfx / cachet-lert.js
Last active August 11, 2016 19:16
Alert bar to show information from the closest incident using cachet API
document.addEventListener( 'DOMContentLoaded', function () {
function cachetAlert(cachetUrl) {
var createAlert = function(incident) {
var divElement = document.createElement('div');
divElement.id = 'cachet-alert';
divElement.setAttribute('style', 'background-color: #FF3D2E; text-align: center; font-family: sans-serif;');
divElement.innerHTML = '<a style="color: #fff; display: block; padding: 5px;" href="'+ cachetUrl +'" target="_blank">'+ incident.name +'</a>';
document.body.insertBefore(divElement, document.body.children[0]);
};
@ignacy
ignacy / async_no_link.ex
Created March 15, 2016 10:51
Example of using Task.Supervisor.async_nolink with Elixir Tasks
@dhbradshaw
dhbradshaw / gist:e2bdeb502b0d0d2acced
Last active August 16, 2023 17:50
Rename field using migrations in django 1.7
To change a field name in django 1.7+
1. Edit the field name in the model (but remember the old field name: you need it for step 3!)
2. Create an empty migration
$ python manage.py makemigrations --empty myApp
3. Edit the empty migration (it's in the migrations folder in your app folder, and will be the most recent migration) by adding
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'),
to the operations list.
@ricn
ricn / comments.js.jsx
Created July 30, 2014 23:08
comments.js.jsx
/** @jsx React.DOM */
var Comment = React.createClass({
render: function () {
return (
<div className="comment">
<h2 className="commentAuthor">
{this.props.author}
</h2>
{this.props.comment}
</div>
@chrisb
chrisb / gist:4d6a09c6cc1ca2e1b14e
Last active November 25, 2022 04:15
Homebrew, Ruby, and Rails on OS X 10.10

OS X 10.10 Guide

Here's what I did to get things working.

1. Install Xcode 6

Yep, over at: https://developer.apple.com

2. Install the Command Line Tools (CLT)

@jeffjohnson9046
jeffjohnson9046 / percent-filter.js
Last active September 4, 2020 23:25
Format percentages in AngularJS
// In app.js or main.js or whatever:
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']);
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17).
myApp.filter('percentage', ['$filter', function ($filter) {
return function (input, decimals) {
return $filter('number')(input * 100, decimals) + '%';
};
}]);
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active December 2, 2024 07:27
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@sturobson
sturobson / gulpfile.js
Last active October 9, 2020 13:01
My gulpfile.js (so far, so simple). Compiles Sass (removes erroneous _partial compilation), autoprefixes the CSS then minifies the CSS into the folder 'dist/CSS'. Uglifys JS into the foloder 'dist/JS'. Minifys SVGs using SVGO, Minifys images with imagemin. Adds gulp-size to calculate project size. Runs development and production tasks
// Deep Breaths //
//////////////////
// Gulp
var gulp = require('gulp');
// Sass/CSS stuff
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
@addyosmani
addyosmani / examples.md
Last active February 23, 2016 18:22
Object.observe() examples from my talk

What are we trying to observe? Raw object data.

// Objects
var obj = { id: 2 };
obj.id = 3; // obj == { id: 3 }
 
// Arrays
var arr = ['foo', 'bar'];
arr.splice(1, 1, 'baz'); // arr == ['foo', 'baz'];