A guide to developing robust stylesheets in SCSS - based on SMACSS
Core goals of SMACSS:
- Increase the semantic value of a section of html and content
- Decrease the expectation of a specific html structure
<!DOCTYPE html> | |
<html > | |
<head> | |
<meta charset="UTF-8"> | |
<title>Create a New Pen</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style>.subscribe-form { | |
width: 100%; | |
overflow: hidden; | |
vertical-align: bottom; |
<!DOCTYPE html> | |
<html > | |
<head> | |
<meta charset="UTF-8"> | |
<title>Select State</title> | |
<style> | |
.select-state-container { | |
margin: 10px auto; | |
width: 300px; | |
} |
<!DOCTYPE html> | |
<html > | |
<head> | |
<meta charset="UTF-8"> | |
<title>Count Down</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/flipclock/0.7.8/flipclock.min.js"></script> | |
<style> | |
.flip-clock-wrapper { |
<!DOCTYPE html> | |
<html > | |
<head> | |
<meta charset="UTF-8"> | |
<title>Select State</title> | |
<style> | |
.select-state-container { | |
margin: 10px auto; | |
width: 300px; | |
} |
A guide to developing robust stylesheets in SCSS - based on SMACSS
Core goals of SMACSS:
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
elem.clientLeft
, elem.clientTop
, elem.clientWidth
, elem.clientHeight
elem.getClientRects()
, elem.getBoundingClientRect()
pi@(none) ~ $ uname -a | |
Linux (none) 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux | |
pi@(none) ~ $ sudo hostname Gopal-pi2 | |
sudo: unable to resolve host (none) | |
pi@(none) ~ $ sudo su | |
sudo: unable to resolve host Gopal-pi2 | |
root@Gopal-pi2:/home/pi# hostname Gopal-pi2 |
public static double sqrtNew(double c){ | |
/* * Computes the square root of a nonnegative number c using | |
* Newton's method: | |
* - initialize t = c | |
* - replace t with the average of c/t and t | |
* - repeat until desired accuracy reached | |
*/ | |
if (c>0) return double.NaN; | |
double err = 1e-15; |