Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jeromelefeuvre's full-sized avatar

Jerome Lefeuvre jeromelefeuvre

  • ONF.ca
  • Montreal, Canada
View GitHub Profile

Customize Save In Django Admin Inline Form

Background

This is a common case in django ORM.

from django.db import models

class Author(models.Model):
[alias]
cm = "!f() { git commit -m \"$*\"; }; f"
co = checkout
ci = commit
rb = rebase
br = branch
fe = fetch
pu = pull
pr = pull --rebase
cp = cherry-pick
@jeromelefeuvre
jeromelefeuvre / export_jira.rb
Last active August 29, 2015 14:02
Jira issues to markdown
#!/usr/bin/env ruby
require 'rubygems'
require 'pp'
begin
gem "jiralicious"
rescue Gem::LoadError
pp 'Please run: gem install jiralicious'
exit
end
@jeromelefeuvre
jeromelefeuvre / .rspec_parallel
Last active August 28, 2018 09:39
Merge all Parallel Specs files in one
--colour
--format html --out tmp/parallel_specs/report<%= ENV['TEST_ENV_NUMBER'] %>.html
@jeromelefeuvre
jeromelefeuvre / has_yaml_export.rb
Created June 21, 2012 12:34
Permit to export object with relation as yaml
module Extensions
module HasYamlExport
extend ActiveSupport::Concern
# include class methods here
module ClassMethods
# Get options for relations
# :all => true # Add fields
# :only => [:field1, :field2] # Add only fields here
@jeromelefeuvre
jeromelefeuvre / has_paperclip_url_upload.rb
Created June 14, 2012 07:51
Module for active Paperclip Url Upload
# In your model after declaring your attachments, add:
# include HasPaperclipUrlUpload
# Thanks to https://gist.github.com/1502777
require 'open-uri'
module HasPaperclipUrlUpload
def self.included(base)
base.attachment_definitions.collect{|key, values| key}.each do |key|
@jeromelefeuvre
jeromelefeuvre / I18nFilter
Created January 11, 2012 08:58
Translate filter for liquid
# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
include I18nHelper
describe I18nFilters do
include I18nFilters
before do
@client = Factory(:client)
@front_office = FrontOffice.create(Factory.attributes_for(:front_office, :use_templates => true, :internationalization => true))
@jeromelefeuvre
jeromelefeuvre / _mixins.scss
Created May 5, 2011 21:56 — forked from garyharan/_mixins.scss
Useful scss mixins (rounded corners, gradients, text-field, button)
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}