Skip to content

Instantly share code, notes, and snippets.

View ruxandrafed's full-sized avatar
🎯
Focusing

Ruxandra Fediuc ruxandrafed

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ruxandrafed on github.
  • I am ruxandrafed (https://keybase.io/ruxandrafed) on keybase.
  • I have a public key ASDB9guaSOXwZm92i4I5X-YZu3CV0cPgsgzSgwMu9Tse6Ao

To claim this, I am signing this object:

const privateMethod = Symbol('privateMethod');
export default class Service {
constructor () {
this.say = "Hello";
}
[privateMethod] () {
console.log(this.say);
}
// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};
function partial(fn /*, rest args */){
return fn.bind.apply(fn, Array.apply(null, arguments).slice(1));
}
const Logger = {
log(level, dateFormat, msg) {
console.log(level, dateFormat, msg);
}
};
function partial(fn /*, rest args */){
const newArgs = Array.apply(null, arguments).slice(1);
return function(){
const fnArgs = newArgs.concat(Array.apply(null, arguments));
fn.apply(null, fnArgs);
}
}
const Logger = {
log(level, dateFormat, msg) {
@ruxandrafed
ruxandrafed / new_gist_file.md
Created July 24, 2017 04:25 — forked from kkas/new_gist_file.md
Browser Rendering Optimization Course Note (for myself)

Browser Rendering Optimization

Critical Rendering Path

Frames

  • If there's any kind of visual change onscreen, from scrolling to animations, the device is going to put up a new picture, or frame, onto the screen for the user to see.
  • Most devices today refresh their screen 60 times a second, which we measure in hertsz.
  • So to much that we need to have 60 frames to put up. Most of the time we'll refer to this as 60 frames a second, or fps.
  • People are expecially good at noticing when we miss one of these frames.
  • If the browser is taking too long to make a frame, it will get missed out. The frame rate will drop and users will see stuttering. If it is really bad, then the whole screen can lock up, which is the worst.

Milliseconds Per Frame

import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };

CSS Specificity

Use the information in this article to answer the following two questions. http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/

Question 1

How do you think the word "cascading" in "Cascading Style Sheets" relates to specificity?

Answer: Because more than one stylesheet rule could apply to a particular piece of HTML, there has to be a known way of determining which specific stylesheet rule applies to which piece of HTML. The CSS specification describes a priority scheme to determine which style rules apply if more than one rule matches against a particular element. In this so-called cascade, priorities (or weights) are calculated and assigned to rules, so that the results are predictable.

Question 2

@ruxandrafed
ruxandrafed / arrayOfLight (JS exercise)
Last active October 5, 2015 17:52
arrayOfLight (JS exercise)
function arrayOfLight(no) {
array = [];
for (i=0; i<=no; i++) {
array.push(i);
};
return array;
};
no = prompt('Give me a number:');
SELECT p.isbn FROM editions AS e
INNER JOIN publishers as p ON e.publisher_id=p.id
WHERE p.name = 'Random House'