Skip to content

Instantly share code, notes, and snippets.

View bogdanconstantinescu's full-sized avatar

Bogdan Constantinescu bogdanconstantinescu

View GitHub Profile
@bogdanconstantinescu
bogdanconstantinescu / model.rb
Created May 9, 2012 16:22
to_slug method for ActiveRecord model
# Hook this up in your ActiveRecord model for a nicer slug
# I use it on before_save :to_slug
def to_slug
# Translate usual characters encountered
convert_map = {
/\@/ => ' at ',
/\&/ => ' and ',
/\%/ => ' percent ',
}
@bogdanconstantinescu
bogdanconstantinescu / Gemfile
Created September 13, 2012 15:48
Async Sinatra vs Express.js
source 'https://rubygems.org'
gem 'thin'
gem 'bundler'
gem 'async_sinatra'
gem 'thin'
@bogdanconstantinescu
bogdanconstantinescu / sketch-never-ending.md
Created July 18, 2017 13:17 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@bogdanconstantinescu
bogdanconstantinescu / base.component.ts
Created November 8, 2019 16:34
Angular BaseComponent
import { OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
export abstract class BaseComponent implements OnDestroy {
public ngDestroyed$ = new Subject();
ngOnDestroy() {
this.ngDestroyed$.next();
this.ngDestroyed$.unsubscribe();
}
@bogdanconstantinescu
bogdanconstantinescu / application.rb
Created May 9, 2012 15:26 — forked from t2/application.rb
Formatting Rails form elements for Twitter Bootstrap error validation
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe
# add nokogiri gem to Gemfile
form_fields = [
'textarea',
'input',
'select'
]
@bogdanconstantinescu
bogdanconstantinescu / private_fork.md
Created December 1, 2021 12:34 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git