background preloader

How to Center Anything With CSS

How to Center Anything With CSS
Recently, we took a dive into the very core concepts behind CSS layout and explored the differences between absolute and relative positioning. We’re going to follow that up with another CSS layout talk, this time based around a fundamental question that almost every new developer asks: how do you center something? There are a bunch of different types of web elements and layout situations, each calling for a unique solution for centering (both vertically and horizontally). Today we’ll go over a bunch of these scenarios so you can wrap your mind around how they work and come away with the confidence to center anything! Who’s This For? I’ve gotten a lot of commenter feedback lately from designers who struggle with the basic methods and concepts of layout in CSS. Having been there quite a few times myself, I know that this is an immensely frustrating period of your professional growth. Horizontally Center an Element As you can see, by default, our div pops up in the top left of the viewport.

How To Use Sublime Text For Live Preview of Code Snippets A web developer may know better about what sublime text is actually capable of. So no need to discuss it here. The one things I kept searching for in Sublime Text or in any similar light weight program was the ability to show the result as soon as you type. Alright! >> Run Sublime Text. >> Create a new file and paste this code in it. import sublime_pluginclass SaveOnModifiedListener(sublime_plugin.EventListener): def on_modified(self, view): view.run_command("save") >> Save it as a .py (python) file. What it actually do is, it saves the file after every keystroke. >> Move this newly created file to, user folder in sublime text directory. C:\Program Files\Sublime Text\Data\Packages\User Installation directory and folder doesn't matter, it could be anywhere. >> Almost done. >> Link your css and javascript to your html file. >> Now to the last magic trick. >> This will refresh the page after every half (0.5) second. >> In Sublime Text you adjust the number of rows or columns if you like.

Why Do Monads Matter? « Sententia cdsmithus (A Side Note: I’ve been formulating the final thoughts on this post for about a week now. In an entirely unrelated coincidence, a good friend of mine and fellow Haskell programmer, Doug Beardsley, ended up writing two posts about monads over the weekend as well. Weird! But don’t fret; this isn’t really the same thing at all. Category Theory for Software Development? Match made in heaven? If you’re a software developer, have you heard about monads and wondered what they were? Or if you’re interested in mathematics, have you heard murmurs in the past about how category theory interests computer science people? These are the kinds of questions I begin with. Where category-based intuition and ideas, and monads in particular, come from in computer programming.Why the future of programming does lie in these ideas, and their omission in today’s mainstream languages has cost us dearly.What the state of the art looks like in applying category-based ideas to problems in computer programming.

The Essentials of Writing High Quality JavaScript Twice a month, we revisit some of our readers’ favorite posts from throughout the history of Nettuts+. This tutorial was first published in October, 2010. The brilliant Stoyan Stefanov, in promotion of his book, "JavaScript Patterns," was kind enough to contribute an excerpt of the book for our readers, which details the essentials of writing high quality JavaScript, such as avoiding globals, using single var declarations, pre-caching length in loops, following coding conventions, and more. This excerpt also includes some habits not necessarily related to the code itself, but more about the overall code creation process, including writing API documentation, conducting peer reviews, and running JSLint. These habits and best practices can help you write better, more understandable, and maintainable code—code to be proud of (and be able to figure out) when revisiting it months and years down the road. Software bugs are costly to fix. Maintainable code means code that:

State Machines – Basics of Computer Science Computer science is what enables programming, but it is possible to do a lot of programming without understanding the computer science concepts underlying the process of computation. This isn’t always a bad thing. When we program we work at a much higher level of abstraction. When we drive a car, we only concern ourselves with two or three pedals, a gearshift and a steering wheel. You can safely operate a car without having any clear idea of how it works. However, if you want to operate a car at the very limits of its capabilities, you need to know a lot more about automobiles than just the three pedals, gearshift and steering wheel. The same is true of programming. The purpose of this article is to provide some fundamental background for computation. Finite State Machine A finite state machine is a mathematical abstraction used to design algorithms. Imagine a device that reads a long piece of paper. As the state machine reads each letter it changes state. Do you see the problem?

Rove Basics of Computational Number Theory Robert Campbell Contents Introduction This document is a gentle introduction to computational number theory. Modular Arithmetic Modular arithmetic is arithmetic using integers modulo some fixed integer N. 7 + 7 = 14 = 2 (mod 12) 5 * 7 = 35 = 11 (mod 12) Further examples can be generated and checked out with the following short programs. Among the basic operations we have missed the division operator. 11 / 5 = 7 (mod 12) as 5 * 7 = 11 (mod 12) 5(-1) = 1 / 5 = 17 (mod 21) as 5 * 17 = 85 = 1 (mod 21) 48 / 31 = 72 (mod 91) as 31 * 72 = 48 (mod 91) 9 / 3 = 7 (mod 12) as 3 * 7 = 21 = 9 (mod 12) As the last example points out, modular division does not always produce a unique result, for other correct answers are 3 and 11 (as 3 * 3 = 9 (mod 12) and 3 * 11 = 33 = 9 (mod 12)). GCD - The Euclidean Algorithm The Euclidean Algorithm solves two problems we have posed: Common Factors - Given two numbers n and m, find any common factors they may have. The algorithm to find gcd(n, m) runs something like this:

Using Vagrant for repeatable local web development For the moment, I’ve an idea of use of independent environments, which could be shared between our devs team, which works on Linux and Windows workstations. So, file ressources could be hosted on parent OS and virtual machine contains real development environment, and the logic is porcessed by the virtual machine, which contains the environment, identic to production server. The dB is shared between all developers, but each developer has it’s own virtual environment, with files which are shared between guest and host. Web developer works in a folder which is shared between Vagrant and his host machine. Each developer machine could be accessed from an external location by a web browser. Each vagrant machine of each developer could be managed from an external location by SSH, to provide maximum of automation. There are boxes, real virtual machines models, which You could turn inside Your workstation. VM machine creation and use $ vagrant package --vagrantfile Vagrantfile.pkg

A Course of F# Study | craftyThoughts I’ve been tinkering off and on with F# for about two years. Now I plan to dive in and do some serious code writing, so I’m gathering all my resources in one place (here) ready to move forward. For anyone with a beginning to intermediate level of experience with F#, this is my recommended course of study. Development Environment You’ll want to install a couple VS extensions. Core Course You’ll find you have to deliberately write F# one statement at a time. Beyond the Basics Once you finish Awesome Princess’ excellent course, you’ll want to continue your graduate studies along with whatever productive coding you are doing. And then there are the bloggers. Geez this is getting kind of long. Here’s the F# open-source community on GitHub. …and last, but not least FPish – Online community of functional developers, more than a blog… Theory Matters Start getting used to the arrow notation F# uses to describe function signatures. Don’t try to force-feed yourself on monads. OK, enough of monads. Notes

Related: