How to Master the Translation of PHP Apps
Building a truly international application is not just about translating strings. Other issues to consider are date and time formats, currency symbols and pluralization. Programmers often underestimate the complexity of localization and get stuck with homemade code that is a pain to maintain. So, let’s talk about PHP Arrays, gettext, frameworks, and Intl.
Convert CSV to JSON in JavaScript
First I take the whole CSV file and split it into an array of lines. Then, I take the first line, which should be the headers, and split that by a comma into an array. Then, I loop through all the lines (skipping the first one) and inside, I loop through the headers and assign the values from each line to the proper object parameters. At this point, you probably want to just return the JavaScript object, but you can also JSON.stringify the result and return the JSON object.
D3.js V5 Choropleth Map
5.x implementation of a choropleth map, using Promises.
Making a Map in D3.js v.5
A pretty specific title, huh? The versioning is key in this map-making how-to. D3.js version 5 has gotten serious with the Promise class which resulted in some subtle syntax changes that proven big enough to cause confusion among the D3.js old dogs and the newcomers. This post guides you through creating a simple map in this specific version of the library. If you’d rather dive deeper into the art of making maps in D3 try the classic guides produced by Mike Bostock.
Conventional Commits
A specification for adding human and machine readable meaning to commit messages.
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
Customizer Export/Import
The Customizer Export/Import plugin allows you to export or import your WordPress customizer settings from directly within the customizer interface! If your theme makes use of the WordPress customizer for its settings, this plugin is for you!
django create app in subdir
To create a «polls» app in the «apps» sub-directory, do the following first to make the directory (assuming you are at the root of your django project):
mkdir apps/polls
Next, run startapp to create «polls» in under the «app» project directory.
startapp polls apps/polls
Install the app;
INSTALLED_APPS = [
‘apps.polls’
]
migrate:
makemigrations polls
migrate
optional:
main urls.py
urlpatterns = [
path(‘polls/’,include(‘apps.polls.urls’),
]
One shared house 2030. How will we live in the year 2030?
welcome to the year 2030.
there are 1.2 billion more people on the planet.
70% of us are living in cities now.
in order to house 1.2 billion more people,
all of us are sharing more household goods and services than ever before.
we refer to this sharing as co-living.
and many more of us are living this way now.
but it’s not a new thing.
communal living has always been a solution to common problems.
like rapid urbanisation, loneliness, and high living costs.
but what does co-living look like in the year 2030?
who is it for?
how has it changed our society?
what are we sharing?
with many more of us now co-living,
there is no one configuration.
discover what type of co-living would be uniquely suited for you.
reserve your spot for ONE SHARED HOUSE 2030.
REM to PX Converter
REM to PX Converter is a free online tool you can use to easily convert rem (root em) to px (pixel). Keep in mind that 1rem is equal to the root font-size, in other words, the font-size on element.
WordPress Create Upload Files and Directories
This tutorial explains how to create new files and directories in the WordPress /uploads/ folder.
Distributor. Safely reuse and syndicate content between WordPress sites
Distributor is a WordPress plugin that makes it easy to syndicate and reuse content across your websites — whether in a single multisite or across the web.
Rewriting JavaScript: Converting an Array of Objects to an Object
const arrayToObject = (array) => array.reduce((obj, item) => { obj[item.id] = item return obj }, {})const peopleObject = arrayToObject(peopleArray) console.log(peopleObject[idToSelect])
Django Girls
We inspire women to fall in love with programming.
Django Girls organize free Python and Django workshops, create open sourced online tutorials and curate amazing first experiences with technology.
Django Girls is a non-profit organization and a community that empowers and helps women to organize free, one-day programming workshops by providing tools, resources and support. We are a volunteer run organization with hundreds of people contributing to bring more amazing women into the world of technology. We are making technology more approachable by creating resources designed with empathy.
During each of our events, 30-60 women build their first web application using HTML, CSS, Python and Django.
Electron. Build cross-platform desktop apps with JavaScript, HTML, and CSS
https://www.youtube.com/watch?v=8YP_nOCO-4Q
Building cross-platform desktop applications comes with a unique set of challenges that can stand in your way when you are trying to transform your ideas into software. Web apps avoid some of these hurdles, but they have limitations that make them impractical for building native desktop applications. Electron lets you harness the best parts of these technologies to build beautiful, cross-platform desktop applications using HTML, JavaScript, and CSS.
Django Slug Tutorial
There are only two steps required: updating our articles/models.py file and articles/urls.py.
In our model, we can add Django’s built-in SlugField. But we must also–and this is the part that typically trips people up–update get_absolute_url as well. That’s where we pass in the value used in our URL.
GoGoCartoJs
A javascript component to create terrific cartography ! GoGoCartoJs is the autonomous frontend part of the GoGoCarto Project
Native image lazy-loading for the web!
The loading attribute allows a browser to defer loading offscreen images and iframes until users scroll near them. loading supports three values:
lazy: is a good candidate for lazy loading.
eager: is not a good candidate for lazy loading. Load right away.
auto: browser will determine whether or not to lazily load.
Not specifying the attribute at all will have the same impact as setting loading=auto.
Five Ways to Lazy Load Images for Better Website Performance
Native lazy loading of images and iframes is super cool. Nothing could be more straightforward than the markup below:
<img src="myimage.jpg" loading="lazy" alt="..." /> <iframe src="content.html" loading="lazy"></iframe>
As you can see, no JavaScript, no dynamic swapping of the src attribute’s value, just plain old HTML.
The loading attribute gives us the option to delay off-screen images and iframes until users scroll to their location on the page. loading can take any of these three values:
lazy: works great for lazy loading
eager: instructs the browser to load the specified content right away
auto: leaves the option to lazy load or not to lazy load up to the browser.
How to use SCSS/SASS in your Django project (NPM Way)
After reading this article, you will get:
How to write SCSS/SASS using NPM for your Django project
How to deploy Django project which uses NPM as front-end solution
How to use SCSS/SASS in your Django project (Python Way)
After reading this article, you will get:
The difference between CSS, SCSS, SASS
How to make Bootstrap SCSS work in your Django project.
How to deploy SCSS in Django project.
Full Stack Python. DevOps
DevOps is the combination of application development and operations, which minimizes or eliminates the disconnect between software developers who build applications and systems administrators who keep infrastructure running.
mod_wsgi Apache module. Official documentation
The mod_wsgi package implements a simple to use Apache module which can host any Python web application which supports the Python WSGI specification.
Awesome Coronavirus. Useful projects and resources for COVID-19
COVID-19 (2019 novel Coronavirus) is a current epidemic as of today. Developers around the world are building applications for the public to get up-to-date and accurate information as quickly as possible.
If you are a developer, you may also be able to contribute to some of these projects.
Lazy Loading Images and Video
Using intersection observer
If you’ve written lazy loading code before, you may have accomplished your task by using event handlers such as scroll or resize. While this approach is the most compatible across browsers, modern browsers offer a more performant and efficient way to do the work of checking element visibility via the intersection observer API.
Use `const` and make your JavaScript code better
First of all, don’t use var. There are a few differences between var, let and const and the most important one to me is that let and const remove the error-prone behavior with variable hoisting.
How to Submit My Website to DuckDuckGo Search Engine?
Unlike other search engines, DuckDuckGo doesn’t offer any kind of webmaster tools.
Duckduckgo also not offers URL submission.
So, Is there any way to submit your site to DuckDuckGo. Yes, they don’t have any kind of a crawler that is going to crawl your website. To index your site, you have to rely on the search results from other search engines and come up with a way to index your site.
There is no need to submit your site to duckduckgo also there is no way to submit.
As duckduckgo automatically index your site.
So, It might take some time to show your site on duckduckgo search Engine.
I have made a Youtube Tutorial on Google, Bing and Yandex Webmaster Submission. Have a look at that.
Print the whole webpage in a single image file
It only does PNG, but Firefox has a way to capture the whole page built in: Shift-F2 brings up a command prompt, which includes a screenshot command. For instance, screenshot –clipboard –fullpage as I was writing this answer produced http://imgur.com/tnplKPE.
If you want something designed to be automated, phantomjs has page.render() which takes a filename and an optional options object, with format and quality entries; the example given is
page.render('google_home.jpeg', {format: 'jpeg', quality: '100'});
WordPress Function Reference: media sideload image
Download an image from the specified URL and attach it to a post.
media_sideload_image($file, $post_id, $desc, $return);
How itty.bitty works
TL;DR:
itty.bitty takes html (or other data), compresses it into a URL fragment, and provides a link that can be shared. When it is opened, it inflates that data on the receiver’s side.
This amazing new web tool lets you create microsites that exist solely as URLs
…self-contained microsites that exist solely as URLs
SymfonyCasts: PHP and Symfony Video Tutorial Screencasts
Simply the Best PHP & Symfony Tutorials
And the official way to learn Symfony
Download Sample Videos
Sample-Videos.com is a 100% FREE service that allows programmers, testers, designers, developers to download sample videos for demo/test use. No matter what video format they use (MP4, FLV, MKV, 3GP); they will be able to test videos on any Smartphone without any hustle. This is a one stop destination for all sample video testing needs. Just search below for the relevant video formats in specific sizes, download them, and start testing.
A mobile screen resolution can be a big challenge when it comes to watching videos online or offline. By testing out videos one can be rest assured regarding the video playback in an app, without annoying the end users. Choose from four different video extensions i.e. 3GP, MKV, FLV, and MP4. The best thing is all of these are free and very easy to download. We provide you with a specific and perfect resolution in all sizes possible with just one simple click. Check out the one which suits your requirements. All you need to do is hit the DOWNLOAD button, and get started.
How to update a URL without reloading the page using vanilla JavaScript
The pushState() method let’s you update the URL and create a new item in the browser history without reloading the page. Because the history is updated, this new URL can be changed with the browser’s forward and backward buttons as well.
Here’s how it works.
history.pushState(state, pageTitle, url);
Syntastic. Syntax checking hacks for vim
Syntastic is a syntax checking plugin for Vim created by Martin Grenfell. It runs files through external syntax checkers and displays any resulting errors to the user. This can be done on demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn’t have to compile their code or execute their script to find them.
Accessibility Tip: Empty alt Attributes
Images with only visual value should have an empty alt attribute set on them. Omitting the alt attribute makes most screen readers read out the entire image URL and providing an alt attribute when the image is for visual purposes only is just as useless.
Custom user taxonomies in WordPress
…the ability to create and use custom taxonomies has been around since 2007. We didn’t get all the cool functions added until 2.8 though.
However, one thing we’ve had since 2.3 was the ability to create taxonomies for any object type, not just posts. In WordPress, there are several object types:
Posts
Users
Comments
Links
So, you can technically create a taxonomy for any object type. Most of WordPress core support is for posts, but the API is extremely well thought out and can handle the other object types with minimal code effort.
This tutorial will focus on registering and using a taxonomy on the user object type. It will not be a 100% solution for everything you can do with a custom user taxonomy. Consider this an extremely rough draft of what’s possible.
TypeRocket WordPress Framework
TypeRocket is like Advanced Custom Fields + Laravel + Magic in WordPress for FREE.
ViviGraphJS. Graph drawing library for JavaScript
VivaGraphJS is designed to be extensible and to support different rendering engines and layout algorithms. Underlying algorithms have been broken out into ngraph.
The larger family of modules can be found by querying npm for «ngraph».
Best way to include JavaScript libraries in Hugo sites
Yet another option: supporting JS/CSS includes in your template based on frontmatter variables. This would allow you to use CDN links so you could forego including the libraries in your source code all together if you like. Otherwise you can use relative links if you want to drop the javascript or CSS files in your static directory.
Frontmatter
--- title: Some catchy title js: https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe.js css: https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.2/photoswipe.css ---
Template partial
You could also support multiple includes if you want to provide scripts as an array in your front matter; you’d just loop through and add a script tag for each entry under js. The same process works for CSS.
CSS Partial
{{ if .Params.css }} <link rel="stylesheet" href="{{ .Params.css }}"> {{ end }}
JS Partial
{{ if .Params.js }} {{ end }}