1629288521
n the US, Gerrymandering is the process of manipulation where politicians rig the maps and skew the results to favour one political party over another. A long-used process, manipulating district boundaries gives one political party an unfair advantage or dilutes the voting power of minority groups. For instance, in 2010, REDMAP, or Republicans’ Redistricting Majority Project, spent $30 million on down-ballot state legislative races. They also managed to win in Florida, North Carolina, Wisconsin, Michigan, and Ohio.
https://analyticsindiamag.com/will-algorithms-be-the-new-warriors-against-gerrymandering/
1653075360
HAML-Lint
haml-lint
is a tool to help keep your HAML files clean and readable. In addition to HAML-specific style and lint checks, it integrates with RuboCop to bring its powerful static analysis tools to your HAML documents.
You can run haml-lint
manually from the command line, or integrate it into your SCM hooks.
gem install haml_lint
If you'd rather install haml-lint
using bundler
, don't require
it in your Gemfile
:
gem 'haml_lint', require: false
Then you can still use haml-lint
from the command line, but its source code won't be auto-loaded inside your application.
Run haml-lint
from the command line by passing in a directory (or multiple directories) to recursively scan:
haml-lint app/views/
You can also specify a list of files explicitly:
haml-lint app/**/*.html.haml
haml-lint
will output any problems with your HAML, including the offending filename and line number.
haml-lint
assumes all files are encoded in UTF-8.
Command Line Flag | Description |
---|---|
--auto-gen-config | Generate a configuration file acting as a TODO list |
--auto-gen-exclude-limit | Number of failures to allow in the TODO list before the entire rule is excluded |
-c /--config | Specify which configuration file to use |
-e /--exclude | Exclude one or more files from being linted |
-i /--include-linter | Specify which linters you specifically want to run |
-x /--exclude-linter | Specify which linters you don't want to run |
-r /--reporter | Specify which reporter you want to use to generate the output |
-p /--parallel | Run linters in parallel using available CPUs |
--fail-fast | Specify whether to fail after the first file with lint |
--fail-level | Specify the minimum severity (warning or error) for which the lint should fail |
--[no-]color | Whether to output in color |
--[no-]summary | Whether to output a summary in the default reporter |
--show-linters | Show all registered linters |
--show-reporters | Display available reporters |
-h /--help | Show command line flag documentation |
-v /--version | Show haml-lint version |
-V /--verbose-version | Show haml-lint , haml , and ruby version information |
haml-lint
will automatically recognize and load any file with the name .haml-lint.yml
as a configuration file. It loads the configuration based on the directory haml-lint
is being run from, ascending until a configuration file is found. Any configuration loaded is automatically merged with the default configuration (see config/default.yml
).
Here's an example configuration file:
linters:
ImplicitDiv:
enabled: false
severity: error
LineLength:
max: 100
All linters have an enabled
option which can be true
or false
, which controls whether the linter is run, along with linter-specific options. The defaults are defined in config/default.yml
.
Option | Description |
---|---|
enabled | If false , this linter will never be run. This takes precedence over any other option. |
include | List of files or glob patterns to scope this linter to. This narrows down any files specified via the command line. |
exclude | List of files or glob patterns to exclude from this linter. This excludes any files specified via the command line or already filtered via the include option. |
severity | The severity of the linter. External tools consuming haml-lint output can use this to determine whether to warn or error based on the lints reported. |
The exclude
global configuration option allows you to specify a list of files or glob patterns to exclude from all linters. This is useful for ignoring third-party code that you don't maintain or care to lint. You can specify a single string or a list of strings for this option.
Some static blog generators such as Jekyll include leading frontmatter to the template for their own tracking purposes. haml-lint
allows you to ignore these headers by specifying the skip_frontmatter
option in your .haml-lint.yml
configuration:
skip_frontmatter: true
The inherits_from
global configuration option allows you to specify an inheritance chain for a configuration file. It accepts either a scalar value of a single file name or a vector of multiple files to inherit from. The inherited files are resolved in a first in, first out order and with "last one wins" precedence. For example:
inherits_from:
- .shared_haml-lint.yml
- .personal_haml-lint.yml
First, the default configuration is loaded. Then the .shared_haml-lint.yml
configuration is loaded, followed by .personal_haml-lint.yml
. Each of these overwrite each other in the event of a collision in configuration value. Once the inheritance chain is resolved, the base configuration is loaded and applies its rules to overwrite any in the intermediate configuration.
Lastly, in order to match your RuboCop configuration style, you can also use the inherit_from
directive, which is an alias for inherits_from
.
haml-lint
is an opinionated tool that helps you enforce a consistent style in your HAML files. As an opinionated tool, we've had to make calls about what we think are the "best" style conventions, even when there are often reasonable arguments for more than one possible style. While all of our choices have a rational basis, we think that the opinions themselves are less important than the fact that haml-lint
provides us with an automated and low-cost means of enforcing consistency.
Add the following to your configuration file:
require:
- './relative/path/to/my_first_linter.rb'
- 'absolute/path/to/my_second_linter.rb'
The files that are referenced by this config should have the following structure:
module HamlLint
# MyFirstLinter is the name of the linter in this example, but it can be anything
class Linter::MyFirstLinter < Linter
include LinterRegistry
def visit_tag
return unless node.tag_name == 'div'
record_lint(node, "You're not allowed divs!")
end
end
end
For more information on the different types on HAML node, please look through the HAML parser code: https://github.com/haml/haml/blob/master/lib/haml/parser.rb
Keep in mind that by default your linter will be disabled by default. So you will need to enable it in your configuration file to have it run.
One or more individual linters can be disabled locally in a file by adding a directive comment. These comments look like the following:
-# haml-lint:disable AltText, LineLength
[...]
-# haml-lint:enable AltText, LineLength
You can disable all linters for a section with the following:
-# haml-lint:disable all
A directive will disable the given linters for the scope of the block. This scope is inherited by child elements and sibling elements that come after the comment. For example:
-# haml-lint:disable AltText
#content
%img#will-not-show-lint-1{ src: "will-not-show-lint-1.png" }
-# haml-lint:enable AltText
%img#will-show-lint-1{ src: "will-show-lint-1.png" }
.sidebar
%img#will-show-lint-2{ src: "will-show-lint-2.png" }
%img#will-not-show-lint-2{ src: "will-not-show-lint-2.png" }
The #will-not-show-lint-1
image on line 2 will not raise an AltText
lint because of the directive on line 1. Since that directive is at the top level of the tree, it applies everywhere.
However, on line 4, the directive enables the AltText
linter for the remainder of the #content
element's content. This means that the #will-show-lint-1
image on line 5 will raise an AltText
lint because it is a sibling of the enabling directive that appears later in the #content
element. Likewise, the #will-show-lint-2
image on line 7 will raise an AltText
lint because it is a child of a sibling of the enabling directive.
Lastly, the #will-not-show-lint-2
image on line 8 will not raise an AltText
lint because the enabling directive on line 4 exists in a separate element and is not a sibling of the it.
If there are multiple directives for the same linter in an element, the last directive wins. For example:
-# haml-lint:enable AltText
%p Hello, world!
-# haml-lint:disable AltText
%img#will-not-show-lint{ src: "will-not-show-lint.png" }
There are two conflicting directives for the AltText
linter. The first one enables it, but the second one disables it. Since the disable directive came later, the #will-not-show-lint
element will not raise an AltText
lint.
You can use this functionality to selectively enable directives within a file by first using the haml-lint:disable all
directive to disable all linters in the file, then selectively using haml-lint:enable
to enable linters one at a time.
Adding a new linter into a project that wasn't previously using one can be a daunting task. To help ease the pain of starting to use Haml-Lint, you can generate a configuration file that will exclude all linters from reporting lint in files that currently have lint. This gives you something similar to a to-do list where the violations that you had when you started using Haml-Lint are listed for you to whittle away, but ensuring that any views you create going forward are properly linted.
To use this functionality, call Haml-Lint like:
haml-lint --auto-gen-config
This will generate a .haml-lint_todo.yml
file that contains all existing lint as exclusions. You can then add inherits_from: .haml-lint_todo.yml
to your .haml-lint.yml
configuration file to ensure these exclusions are used whenever you call haml-lint
.
By default, any rules with more than 15 violations will be disabled in the todo-file. You can increase this limit with the auto-gen-exclude-limit
option:
haml-lint --auto-gen-config --auto-gen-exclude-limit 100
If you use vim
, you can have haml-lint
automatically run against your HAML files after saving by using the Syntastic plugin. If you already have the plugin, just add let g:syntastic_haml_checkers = ['haml_lint']
to your .vimrc
.
If you use vim
8+ or Neovim
, you can have haml-lint
automatically run against your HAML files as you type by using the Asynchronous Lint Engine (ALE) plugin. ALE will automatically lint your HAML files if it detects haml-lint
in your PATH
.
If you use SublimeLinter 3
with Sublime Text 3
you can install the SublimeLinter-haml-lint plugin using Package Control.
If you use atom
, you can install the linter-haml plugin.
If you use TextMate 2
, you can install the Haml-Lint.tmbundle bundle.
If you use Visual Studio Code
, you can install the Haml Lint extension
If you'd like to integrate haml-lint
into your Git workflow, check out our Git hook manager, overcommit.
To execute haml-lint
via a Rake task, make sure you have rake
included in your gem path (e.g. via Gemfile
) add the following to your Rakefile
:
require 'haml_lint/rake_task'
HamlLint::RakeTask.new
By default, when you execute rake haml_lint
, the above configuration is equivalent to running haml-lint .
, which will lint all .haml
files in the current directory and its descendants.
You can customize your task by writing:
require 'haml_lint/rake_task'
HamlLint::RakeTask.new do |t|
t.config = 'custom/config.yml'
t.files = ['app/views', 'custom/*.haml']
t.quiet = true # Don't display output from haml-lint to STDOUT
end
You can also use this custom configuration with a set of files specified via the command line:
# Single quotes prevent shell glob expansion
rake 'haml_lint[app/views, custom/*.haml]'
Files specified in this manner take precedence over the task's files
attribute.
Code documentation is generated with YARD and hosted by RubyDoc.info.
We love getting feedback with or without pull requests. If you do add a new feature, please add tests so that we can avoid breaking it in the future.
Speaking of tests, we use Appraisal to test against both HAML 4 and 5. We use rspec
to write our tests. To run the test suite, execute the following from the root directory of the repository:
appraisal bundle install
appraisal bundle exec rspec
All major discussion surrounding HAML-Lint happens on the GitHub issues page.
If you're interested in seeing the changes and bug fixes between each version of haml-lint
, read the HAML-Lint Changelog.
Author: sds
Source Code: https://github.com/sds/haml-lint
License: MIT license
1663559281
Learn how to create a to-do list app with local storage using HTML, CSS and JavaScript. Build a Todo list application with HTML, CSS and JavaScript. Learn the basics to JavaScript along with some more advanced features such as LocalStorage for saving data to the browser.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>To Do List With Local Storage</title>
<!-- Font Awesome Icons -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"
/>
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500&display=swap"
rel="stylesheet"
/>
<!-- Stylesheet -->
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container">
<div id="new-task">
<input type="text" placeholder="Enter The Task Here..." />
<button id="push">Add</button>
</div>
<div id="tasks"></div>
</div>
<!-- Script -->
<script src="script.js"></script>
</body>
</html>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: #0b87ff;
}
.container {
width: 90%;
max-width: 34em;
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
}
#new-task {
position: relative;
background-color: #ffffff;
padding: 1.8em 1.25em;
border-radius: 0.3em;
box-shadow: 0 1.25em 1.8em rgba(1, 24, 48, 0.15);
display: grid;
grid-template-columns: 9fr 3fr;
gap: 1em;
}
#new-task input {
font-family: "Poppins", sans-serif;
font-size: 1em;
border: none;
border-bottom: 2px solid #d1d3d4;
padding: 0.8em 0.5em;
color: #111111;
font-weight: 500;
}
#new-task input:focus {
outline: none;
border-color: #0b87ff;
}
#new-task button {
font-family: "Poppins", sans-serif;
font-weight: 500;
font-size: 1em;
background-color: #0b87ff;
color: #ffffff;
outline: none;
border: none;
border-radius: 0.3em;
cursor: pointer;
}
#tasks {
background-color: #ffffff;
position: relative;
padding: 1.8em 1.25em;
margin-top: 3.8em;
width: 100%;
box-shadow: 0 1.25em 1.8em rgba(1, 24, 48, 0.15);
border-radius: 0.6em;
}
.task {
background-color: #ffffff;
padding: 0.3em 0.6em;
margin-top: 0.6em;
display: flex;
align-items: center;
border-bottom: 2px solid #d1d3d4;
cursor: pointer;
}
.task span {
font-family: "Poppins", sans-serif;
font-size: 0.9em;
font-weight: 400;
}
.task button {
color: #ffffff;
padding: 0.8em 0;
width: 2.8em;
border-radius: 0.3em;
border: none;
outline: none;
cursor: pointer;
}
.delete {
background-color: #fb3b3b;
}
.edit {
background-color: #0b87ff;
margin-left: auto;
margin-right: 3em;
}
.completed {
text-decoration: line-through;
}
//Initial References
const newTaskInput = document.querySelector("#new-task input");
const tasksDiv = document.querySelector("#tasks");
let deleteTasks, editTasks, tasks;
let updateNote = "";
let count;
//Function on window load
window.onload = () => {
updateNote = "";
count = Object.keys(localStorage).length;
displayTasks();
};
//Function to Display The Tasks
const displayTasks = () => {
if (Object.keys(localStorage).length > 0) {
tasksDiv.style.display = "inline-block";
} else {
tasksDiv.style.display = "none";
}
//Clear the tasks
tasksDiv.innerHTML = "";
//Fetch All The Keys in local storage
let tasks = Object.keys(localStorage);
tasks = tasks.sort();
for (let key of tasks) {
let classValue = "";
//Get all values
let value = localStorage.getItem(key);
let taskInnerDiv = document.createElement("div");
taskInnerDiv.classList.add("task");
taskInnerDiv.setAttribute("id", key);
taskInnerDiv.innerHTML = `<span id="taskname">${key.split("_")[1]}</span>`;
//localstorage would store boolean as string so we parse it to boolean back
let editButton = document.createElement("button");
editButton.classList.add("edit");
editButton.innerHTML = `<i class="fa-solid fa-pen-to-square"></i>`;
if (!JSON.parse(value)) {
editButton.style.visibility = "visible";
} else {
editButton.style.visibility = "hidden";
taskInnerDiv.classList.add("completed");
}
taskInnerDiv.appendChild(editButton);
taskInnerDiv.innerHTML += `<button class="delete"><i class="fa-solid fa-trash"></i></button>`;
tasksDiv.appendChild(taskInnerDiv);
}
//tasks completed
tasks = document.querySelectorAll(".task");
tasks.forEach((element, index) => {
element.onclick = () => {
//local storage update
if (element.classList.contains("completed")) {
updateStorage(element.id.split("_")[0], element.innerText, false);
} else {
updateStorage(element.id.split("_")[0], element.innerText, true);
}
};
});
//Edit Tasks
editTasks = document.getElementsByClassName("edit");
Array.from(editTasks).forEach((element, index) => {
element.addEventListener("click", (e) => {
//Stop propogation to outer elements (if removed when we click delete eventually rhw click will move to parent)
e.stopPropagation();
//disable other edit buttons when one task is being edited
disableButtons(true);
//update input value and remove div
let parent = element.parentElement;
newTaskInput.value = parent.querySelector("#taskname").innerText;
//set updateNote to the task that is being edited
updateNote = parent.id;
//remove task
parent.remove();
});
});
//Delete Tasks
deleteTasks = document.getElementsByClassName("delete");
Array.from(deleteTasks).forEach((element, index) => {
element.addEventListener("click", (e) => {
e.stopPropagation();
//Delete from local storage and remove div
let parent = element.parentElement;
removeTask(parent.id);
parent.remove();
count -= 1;
});
});
};
//Disable Edit Button
const disableButtons = (bool) => {
let editButtons = document.getElementsByClassName("edit");
Array.from(editButtons).forEach((element) => {
element.disabled = bool;
});
};
//Remove Task from local storage
const removeTask = (taskValue) => {
localStorage.removeItem(taskValue);
displayTasks();
};
//Add tasks to local storage
const updateStorage = (index, taskValue, completed) => {
localStorage.setItem(`${index}_${taskValue}`, completed);
displayTasks();
};
//Function To Add New Task
document.querySelector("#push").addEventListener("click", () => {
//Enable the edit button
disableButtons(false);
if (newTaskInput.value.length == 0) {
alert("Please Enter A Task");
} else {
//Store locally and display from local storage
if (updateNote == "") {
//new task
updateStorage(count, newTaskInput.value, false);
} else {
//update task
let existingCount = updateNote.split("_")[0];
removeTask(updateNote);
updateStorage(existingCount, newTaskInput.value, false);
updateNote = "";
}
count += 1;
newTaskInput.value = "";
}
});
#html #css #javascript
1606290330
App Store Optimization is all about improving the visibility of a particular Android /iOS Mobile App on the App Store. Mobile App to optimize? Then go for Best SEO Company in New Zealand
How does ASO Really Work?
ASO is the process of improving the visibility of a mobile app in an app store. Just like search engine optimization (SEO) is for websites, App Store Optimization (ASO) is for mobile apps. Specifically, app store optimization includes the process of ranking highly in an app store’s search results and top charts rankings. Lia Infraservices the Top SEO Company in New Zealand and ASO marketers agrees that ranking higher in search results and top charts rankings will drive more downloads for an app.
ASO Focus on 2 Areas:
A. Search Optimization
B. Behavioral Approach
/The more often the app appears in search results = the more installs /
Note: The app name is the strongest key phrase.
5 point method to Choose Keywords:
1.Create a list of general keywords based on the app description.
2.Find the Top 5 apps that target the already selected keywords.
3.Find keywords that work best for each of the 5 apps.
4.Now you should have created quite a large list of keywords. Get rid of those which don’t fit your app.
5.Create 100 characters, a comma separated string that contains the best keywords you chose.
a.Application name
b.Rating
c.Screenshots / video preview
d.App description
Is your Mobile App Optimized?
When it comes to app downloads and revenue, approach the SEO Company in New Zealand, your app will do much better almost immediately after optimization. If you are interested in learning what the other factors that influence building an organic increase of app popularity are, you should get your mobile app developed by the expert SEO agency in New Zealand. Build your Android & iOS app at Lia Infraservices at cost and time effective.
#seo company in new zealand #seo services in new zealand #seo agency in new zealand #top seo company in new zealand #best seo company in new zealand #top digital marketing company in new zealand
1596017429
Are you looking for a top mobile app development company in New York? Please find a list of the Best App Development Companies in New York that help to build high-quality, Robust, high-performance mobile app with advanced technology and features at an affordable price.
#best app development companies in new york #top app development companies in new york #custom app development companies in new york #leading app development companies in new york #app development companies in new york
1596779843
Are you finding top mobile app development companies in New York? Hire top mobile app developers from New York selected by Topdevelopers.co by their performance.
Listing the elite and most immaculate among the top mobile app development companies and firms is our prime motto at TopDevelopers. We believe in providing the best, probably the most comprehensive companies so that our visitors could get their one-stop solutions. We comprehend in-depth analysis in the process of company selection and filter it at many levels so that only the best comes out. With the plethora of options regarding mobile app development companies available for the users, time becomes an important factor. Thus at TopDevelopers, we render simple and lucid searching options so that the visitor gets the best possible result according to their query and search.
Find Now: List of Best Mobile App Development Firms & Mobile App Developers in New York
#mobile app development service providers in new york #top mobile app development companies in new york #new york based top mobile app development firms #best mobile app developers at new york #new york state #top mobile app developers