Skip to content

Instantly share code, notes, and snippets.

View andytron's full-sized avatar

Andrew Huang andytron

View GitHub Profile
.declaration-order {
/* Positioning */
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100;
/* Box-model */
@andytron
andytron / visually-hidden.css
Last active April 25, 2019 10:15
Hides the element from view and removes it from workflow but still lets screen readers know about it; full browser compatibility
.visually-hidden {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
padding:0 !important;
border:0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
@Component({
selector: 'street-map',
template: '<map-window></map-window><map-controls></map-controls>',
})
// Component controller
class StreetMap {
ngOnInit() {
// Properties are resolved and things like
// this.mapWindow and this.mapControls
// had a chance to resolve from the
class Library {
books: LibraryBook[] = []; // books var is an empty array
/* there is no constructor(), as there is nothing else to set besides books */
addBooks(...newBooks: LibraryBook[]) { // newBooks rest parameters takes an arbitrary number of arguments
this.books.push(...newBooks); // which will then be appended to books
}
checkOut(book: LibraryBook) {
book.available = false;
}
checkIn(book: LibraryBook) {
@andytron
andytron / weinre_instructions.md
Created November 18, 2015 18:23
How to connect a mobile device to desktop port via weinre
  1. On wireless network, go into sys prefs and get your machine's ip address.
  2. On the mobile device, connect to the same wireless network as your machine. Then go into wireless settings, turn http proxy to manual and enter the following: server: your laptop ip address port: 8888
  3. Charles should detect that the phone is trying to connect and you will have to allow it via the prompt from within the program.
  4. On phone, use fbs.forbes.com address with port 9000 and the url appendage to access the page.
@andytron
andytron / 0_reuse_code.js
Created November 4, 2015 20:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console