Skip to content

Instantly share code, notes, and snippets.

View ArnisL's full-sized avatar
🦊

Arnis Lapsa ArnisL

🦊
View GitHub Profile
@codebrew
codebrew / assets.js.erb
Created November 29, 2011 20:31
javascript asset helper
// helper to create proper asset paths if an asset host is configured
App.assets = {
assets : {
<% AssetsUtil.images.each do |img| %>
"<%= img %>" : "<%= asset_path(img) %>",
<% end %>
},
@lulalala
lulalala / rspecgrep.sh
Created November 2, 2012 09:36
rspec with grep to run selected specs
function rspecgrep()
{
SPK_FILES=`find spec -type f -name "*_spec.rb" | grep $1`
echo $SPK_FILES
time rspec $SPK_FILES --format documentation
}
@javiertoledo
javiertoledo / README.txt
Created September 7, 2012 03:40
Hack to allow unions on ActiveRecord models
Add union_hack.rb to your project, for example at lib folder and ensure you're loading it on your application.rb file:
# You'll need to add something like that
config.autoload_paths += %W(#{config.root}/lib)
Then extend your favourite model with the module and you'll be able to do unions with unique records, sorted by any fields and limited in number of records (see my_timeline_method):
class Profile < ActiveRecord::Base
extend UnionHack
This diff is a modified version of a diff written by Arnis Lapsa.
[ The original can be found here: https://gist.github.com/ArnisL/6156593 ]
This diff adds support to tmux for 24-bit color CSI SRG sequences. This
allows terminal based programs that take advantage of it (e.g., vim or
emacs with https://gist.github.com/choppsv1/73d51cedd3e8ec72e1c1 patch)
to display 16 million colors while running in tmux.
The primary change I made was to support ":" as a delimeter as well
require 'bundler/inline'
require 'json'
require 'uri'
require 'net/http'
gemfile(true) do
gem 'inflecto'
gem 'rom', github: 'rom-rb/rom'
gem 'rom-support', github: 'rom-rb/rom-support'
gem 'rom-http', github: 'rom-rb/rom-http'
@ArnisL
ArnisL / after.cs
Created October 19, 2011 22:02
refactoring == joy
namespace Interreg.App.Audit.Application{
using Domain.Model.Applications;
public class ApplicationAudit:Audit{
public override void AttachHandlers(){
On<AttachmentAdded>(e=>e.Source.LogEvent(
"Attachment named '{0}' added".With(e.Attachment.Name)));
On<AttachmentRemoved>(e=>e.Source.LogEvent(
"Attachment named '{0}' removed".With(e.Attachment.Name)));