Skip to content

Instantly share code, notes, and snippets.

View aldesantis's full-sized avatar

Alessandro Desantis aldesantis

View GitHub Profile
app = angular.module('app', [
'ngRoute',
'pascalprecht.translate'
]);
app.config(['$translateProvider', function($translateProvider) {
$translateProvider.useStaticFilesLoader({
prefix: 'locales/',
suffix: '.json'
});
<h1 translate>pages.home.heading</h1>
en:
pages:
home:
heading: 'Hello, world!'
require 'rails_helper'
RSpec.feature 'The home page' do
scenario 'Visiting the home' do
visit '/'
expect(page).to have_content I18n.t('pages.home.heading')
end
end
var myApp = angular.module('myApp');
myApp.directive('selectPicker', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
$(element).selectpicker();
$(element).change(function() {
@aldesantis
aldesantis / images.html
Created November 3, 2015 12:06
Responsive images
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<title>Immagini</title>
<style>
.container {
max-width: 500px;
MyEngine.configure do |config|
# Description of the setting here...
config.setting1 = :value
end
module Crowdster
class Configuration
attr_accessor :setting1, :setting2
end
end
module Crowdster
class << self
attr_reader :config
def configure
@config = Configuration.new
yield config
end
end
end
module Crowdster
module Api
class ApplicationController < Crowdster.config.base_controller.constantize
end
end
end