This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
// Declare TabsService as a provider in app.module.ts | |
// Inject TabsService in your class: constructor(public tabs: TabsService){} | |
// Use the this.tabs.hide() or this.tabs.show() methods wherever you want | |
@Injectable() | |
export class TabsService { | |
constructor() {} | |
public hide() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* extend the localStorageService (https://github.com/grevory/angular-local-storage) | |
* | |
* - now its possible that data stored in localStorage can expire and will be deleted automagically | |
* - usage localStorageService.set(key, val, expire) | |
* - expire is an integer defininig after how many hours the value expires | |
* - when it expires, it is deleted from the localStorage | |
*/ | |
app.config(($provide) => { | |
$provide.decorator('localStorageService', ($delegate) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
# An abstract decorator useful for decorating Active Record objects. | |
class ActiveRecordDecorator < SimpleDelegator | |
# A proxy for the decorator class to allow the delegation of certain class | |
# methods to the decorated object's class. | |
class ClassProxy < SimpleDelegator | |
def initialize(decorator_class, decorated_class) | |
super decorator_class | |
self.decorated_class = decorated_class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let(:organisation_customer) do | |
{ | |
notes: "hot shot lawyer" , | |
staff_member_uuid: staff_member.uuid, | |
created_at: DateTime.now.to_s, | |
email: customer.email, | |
name: customer.name, | |
uuid: "123456" | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// This plugin replaces text in a file with the app version from config.xml. | |
var wwwFileToReplace = "js/build.js"; | |
var fs = require('fs'); | |
var path = require('path'); | |
var rootdir = process.argv[2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y | |
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'" | |
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'" | |
sudo su - postgres -c "service postgresql stop" | |
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.json_append(data json, insert_data json) | |
RETURNS json | |
IMMUTABLE | |
LANGUAGE sql | |
AS $$ | |
SELECT ('{'||string_agg(to_json(key)||':'||value, ',')||'}')::json | |
FROM ( | |
SELECT * FROM json_each(data) | |
UNION ALL | |
SELECT * FROM json_each(insert_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# Usage in html template: | |
"xxx | nl2br" | |
<div ng-bind-html=" YourString | nl2br "></div> | |
or: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add these two gems | |
gem 'ice_cube', '0.9.3' | |
gem 'squeel', '1.0.16' |
NewerOlder