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
f.input :choice_field, :as=>:radio_buttons, :item_wrapper_class=>'inline', :collection=>1..4 |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
<!-- Rails automatically strips tags when outputting strings with html on them --> | |
<%= '<div>You are not alone</div>' %> | |
<!-- However, you may want to escape the HTML so that you can display the tags in the output --> | |
<%= h '<div>This will display with escaped html tags</div>' %> | |
<!-- There are some instances where you would want text with tags to be actually rendered --> | |
<%= raw '<div>I will be a div</div><br /><span>I will be under div</div>' %> |
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
bundle config build.nokogiri --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.2 | |
bundle install |
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
// app.module.ts | |
import { ModalModule } from 'ng2-bootstrap'; | |
@NgModule({ | |
bootstrap: [AppComponent], | |
// other code removed for brevity | |
imports: [ | |
// error if not using forRoot() | |
ModalModule.forRoot() | |
] |
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 { Component, OnInit, ViewChild } from '@angular/core'; | |
import { LazyLoadEvent, DataTable } from 'primeng/primeng'; | |
import { Router, ActivatedRoute } from '@angular/router'; | |
// component | |
declare var jQuery: any; | |
params = {page: 1, page_size: 10}; | |
paginator = {total_records: 0, per_page: 10, total_pages: 0, current_page: 1}; |
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
// pipes/truncate.pipe.ts | |
import { Pipe, PipeTransform } from '@angular/core'; | |
import * as _ from 'lodash'; | |
@Pipe({ name: 'truncate' }) | |
export class TruncatePipe implements PipeTransform { | |
transform(value: string, chars?: number): string { | |
let length = chars ? chars : 100; | |
return _.truncate(value, {length: length }); | |
} |
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
"scripts": { | |
"ng": "ng", | |
"heroku-prebuild": "npm install -g http-server", | |
"heroku-postbuild": "ng build --prod", | |
"start": "http-server dist/", | |
"build": "ng build", | |
"test": "ng test", | |
"lint": "ng lint", | |
"e2e": "ng e2e" | |
}, |
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
// my.e2e-spec.ts | |
import { $, $$ } from 'protractor'; | |
describe('MyDOM', ()=> { | |
it('should have a header with my text', () => { | |
expect($('h1.myHeader').getText()).toBe('My Header'); | |
}); | |
it('should have 3 list items', () => { | |
expect($$('#myList li').count()).toEqual(3)); |
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
<h1 id="myHeader">My Header</h1> | |
<ul id="myList"> | |
<li>My Item #1</li> | |
<li>My Item #1</li> | |
<li>My Item #1</li> | |
</ul> |
OlderNewer