1311 private links
Gist résumant les méthodes d'itération des arrays en JS (hors for...of
).
EDIT, save:
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
Intro
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and what happened during the operation.
Below are some of the methods that iterate - in other words, that operate on the entire list, one item at a time. When you call them, you provide a callback function - a single function that expects to operate on one item at a time. Based on the Array method you've chosen, the callback gets specific arguments, and may be expected to return a certain kind of value - and (except for forEach
) the return value determines the final return value of the overarching array operation. Although most of the methods are guaranteed to execute for each item in the array - for all of them - some of the methods can stop iterating partway through; when applicable, this is indicated below.
All array methods iterate in what is traditionally called "left to right" - more accurately (and less ethnocentrically) from index 0
, to index length - 1
- also called "start" to "end". reduceRight
is an exception in that it iterates in reverse - from end
to start
.
forEach
:
- callback answers: here’s an item. do something nutty with it, i don't care what.
- callback gets these arguments:
item
,index
,list
- final return value: nothing - in other words,
undefined
- example use case:
[1, 2, 3].forEach(function (item, index) {
console.log(item, index);
});
map
:
- callback answers: here’s an item. what should i put in the new list in its place?
- callback gets these arguments:
item
,index
,list
- final return value: list of new items
- example use case:
const three = [1, 2, 3];
const doubled = three.map(function (item) {
return item * 2;
});
console.log(three === doubled, doubled); // false, [2, 4, 6]
filter
:
- callback is a predicate - it should return a truthy or falsy value
- callback answers: should i keep this item?
- callback gets these arguments:
item
,index
,list
- final return value: list of kept items
- example use case:
const ints = [1, 2, 3];
const evens = ints.filter(function (item) {
return item % 2 === 0;
});
console.log(ints === evens, evens); // false, [2]
reduce
:
- callback answers: here’s the result from the previous iteration. what should i pass to the next iteration?
- callback gets these arguments:
result
,item
,index
,list
- final return value: result of last iteration
- example use case:
// NOTE: `reduce` and `reduceRight` take an optional "initialValue" argument, after the reducer callback.
// if omitted, it will default to the first item.
const sum = [1, 2, 3].reduce(function (result, item) {
return result + item;
}, 0); // if the `0` is omitted, `1` will be the first `result`, and `2` will be the first `item`
reduceRight
: (same as reduce
, but in reversed order: last-to-first)
some
:
- callback is a predicate - it should return a truthy or falsy value
- callback answers: does this item meet your criteria?
- callback gets these arguments:
item
,index
,list
- final return value:
true
after the first item that meets your criteria, elsefalse
- note: stops iterating once it receives a truthy value from your callback.
- example use case:
const hasNegativeNumbers = [1, 2, 3, -1, 4].some(function (item) {
return item < 0;
});
console.log(hasNegativeNumbers); // true
every
:
- callback is a predicate - it should return a truthy or falsy value
- callback answers: does this item meet your criteria?
- callback gets these arguments:
item
,index
,list
- final return value:
false
after the first item that failed to meet your criteria, elsetrue
- note: stops iterating once it receives a falsy value from your callback.
- example use case:
const allPositiveNumbers = [1, 2, 3].every(function (item) {
return item > 0;
});
console.log(allPositiveNumbers); // true
find
:
- callback is a predicate - it should return a truthy or falsy value
- callback answers: is this item what you’re looking for?
- callback gets these arguments:
item
,index
,list
- final return value: the item you’re looking for, or undefined
- note: stops iterating once it receives a truthy value from your callback.
- example use case:
const objects = [{ id: 'a' }, { id: 'b' }, { id: 'c' }];
const found = objects.find(function (item) {
return item.id === 'b';
});
console.log(found === objects[1]); // true
findIndex
:
- callback is a predicate - it should return a truthy or falsy value
- callback answers: is this item what you’re looking for?
- callback gets these arguments:
item
,index
,list
- final return value: the index of the item you’re looking for, or
-1
- note: stops iterating once it receives a truthy value from your callback.
- example use case:
const objects = [{ id: 'a' }, { id: 'b' }, { id: 'c' }];
const foundIndex = objects.findIndex(function (item) {
return item.id === 'b';
});
console.log(foundIndex === 1); // true
Une alternative à Gitlab en plus léger. Sur la demo ça a l'air joli et réactif.
Gitlab est cool mais me pose quelques problèmes :
- il bouffe énormément de RAM : 4Go pour lui tout seul et il arrive quand même à swapper s'il n'est pas redémarré de temps en temps.
- du coup, des lenteurs assez régulières.
- un certain nombre de nouvelles fonctionnalités qui ne sont développées que pour la version Enterprise Edition (ex : le système de review qu'on retrouve sur Github).
Mais :
- Gitlab CI <3
Trouver le profile Firefox :
- Linux :
~/.mozilla/
- Windows:
"%APPDATA%\Mozilla\"
Dans le dossier du profil, créer un dossier chrome
, puis un fichier userChrome.css
à l'intérieur de celui ci, contenant :
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
#TabsToolbar {
visibility:collapse;
}
#sidebar-header {
display:none;
}
EDIT:
You need to set toolkit.legacyUserProfileCustomizations.stylesheets to true with about:config, otherwise userChrome.css (and userContent.css) in your profile is simply ignored by Firefox.
EDIT2: Upated for windows Sidebery:
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
#TabsToolbar .toolbar-items #tabbrowser-tabs,
#TabsToolbar .toolbar-items .toolbarbutton-1 {
display:none;
}
#sidebar-header {
display: none;
}
EDIT3: In latest Ubuntu symlink are not working because Firefox is a snap package. I had to create a regular file in ~/snap/firefox/common/.mozilla/firefox/
Free UML Tool for Fast UML Diagrams
La cause la plus probable de cette disparition du nom de domaine wlp-acs.com est un oubli de l’opérateur du système, Atos Worldline, qui avait créé le nom de domaine le 12 juin 2007.
Bravo les gars.
Un de mes serveurs a cramé cette nuit. :(
Donc il va falloir que je fasse en urgence la migration que je repousse depuis des mois...
En attendant, sont down (entre autres) :
- mails
- river
- wiki
The vast majority of software services and systems should aim for almost-perfect reliability rather than perfect reliability—that is, 99.999 or 99.99 percent rather than 100 percent—because users cannot tell the difference between a service being 100 percent available and less than "perfectly" available. There are many other systems in the path between user and service (laptop, home WiFi, ISP, the power grid, ...), and those systems collectively are far less than 100 percent available. Thus, the marginal difference between 99.99 percent and 100 percent gets lost in the noise of other unavailability, and the user receives no benefit from the enormous effort required to add that last fractional percent of availability
Un papier détaillé sur la haute dispo et les dépendances d'un service.
Laura Pfeiffer raconte comment une inspection de l'entreprise Téfal, en Haute-Savoie, qui tourne au calvaire la conduit à devenir lanceuse d'alerte sur les pressions subies par sa profession.
Voilà un mug qui devrait tenir votre boisson bien chaude. Oh oui, très très chaude.
La v0.9.0 de Shaarli a été publiée !
Deux grands changements ont été apportés :
- un nouveau thème (merci encore pour vos retours)
- une API REST
Vu qu'il s'agit de fonctionnalités qui ont demandé beaucoup de travail, cette version majeure est un peu plus chargée que d'autres. On espère qu'aucun bug ne s'est glissé dedans. Si jamais c'était le cas, remontez les sur Github. :)
Changelog
This release introduces the REST API, and requires updating HTTP server
configuration to enable URL rewriting, see:
- https://shaarli.github.io/api-documentation/
- https://github.com/shaarli/Shaarli/wiki/Server-configuration
WARNING: Shaarli now requires PHP 5.5+.
Added
- REST API v1
- Slim framework
- JSON Web Token (JWT) authentication
- versioned API endpoints:
/api/v1/info
: get general information on the Shaarli instance/api/v1/links
: get a list of shaared links/api/v1/history
: get a list of latest actions
Theming:
- Introduce a new theme
- Allow selecting themes/templates from the configuration page
- New/Edit link form can be submitted using CTRL+Enter in the textarea
- Shaarli version is displayed in the footer when logged in
- Add plugin placeholders to Atom/RSS feed templates
- Add OpenSearch to feed templates
- Add
campaign_
to the URL cleanup pattern list - Add an AUTHORS file and Makefile target to list authors from Git commit data
- Link imports are now logged in
data/
folder, and can be debug usingdev.debug=true
setting. composer.lock
is now included in git file to allow propercomposer install
- History mechanism which logs link addition/modification/deletion
Changed
- Docker: enable nginx URL rewriting for the REST API
- Theming:
- Move
user.css
to thedata
folder - Move default template files to a subfolder (
default
) - Rename the legacy theme to
vintage
- Private only filter is now displayed as a search parameter
- Autocomplete: pre-select the first element
- Display daily date in the page title (browser title)
- Timezone lists are now passed as an array instead of raw HTML
- Move
- Move PubSubHub to a dedicated plugin
- Coding style:
- explicit method visibility
- safe boolean comparisons
- remove unused variables
- The updater now keeps custom theme preferences
- Simplify the COPYING information
- Improved client locale detection
- Improved date time display depending on the locale
- Partial namespace support for Shaarli classes
- Shaarli version is now only present in
shaarli_version.php
- Human readable maximum file size upload
Removed
- PHP < 5.5 compatibility
- ReadItYourself plugin
Fixed
- Ignore generated release tarballs
- Hide default port when behind a reverse proxy
- Fix a typo in the Markdown plugin description
- Fix the presence of empty tags for private tags and in search results
- Fix a fatal error during the install
- Fix permalink image alignment in daily page
- Fix the delete button in
editlink
- Fix redirection after link deletion
- Do not access LinkDB links by ID before the Updater applies migrations
- Remove extra spaces in the bookmarklet's name
- Piwik plugin: Piwik URL protocol can now be set (http or https)
- All inline JS has been moved to dedicated JS files
- Keep tags after login redirection
Security
- Markdown plugin: escape HTML entities by default
Download Google Fonts locally.
EDIT : En fait c'est super bien planqué.
Ajouter la police au "panier" avec le petit +
Cliquer sur la barre noir en bas qui liste tout ce qu'on a sélectionné
Cliquer sur le bouton Download en haut à droite
https://links.alwaysdata.net/?tzsOHw
EDIT 2 : Google ne semble que permettre de télécharger des TTF.
Google a trouvé un moyen de générer des collisions de hash SHA-1, et donc de générer deux documents différents avec des hash identiques.
Ce n'est pas une faille dans l'algorithme, mais plus sa relative faiblesse qui rend cette attaque plus efficace qu'un simple bruteforce (inenvisageable aujourd'hui).
Bref, pour vos hash, utilisez SHA-256 dit Google.
Alias | Command | Description |
---|---|---|
yaconf | yaourt -C | Fix all configuration files with vimdiff |
yain | yaourt -S | Install packages from the repositories |
yains | yaourt -U | Install a package from a local file |
yainsd | yaourt -S --asdeps | Install packages as dependencies of another package |
yaloc | yaourt -Qi | Display information about a package in the local database |
yalocs | yaourt -Qs | Search for packages in the local database |
yalst | yaourt -Qe | List installed packages including from AUR (tagged as "local") |
yamir | yaourt -Syy | Force refresh of all package lists after updating mirrorlist |
yaorph | yaourt -Qtd | Remove orphans using yaourt |
yare | yaourt -R | Remove packages, keeping its settings and dependencies |
yarem | yaourt -Rns | Remove packages, including its settings and unneeded dependencies |
yarep | yaourt -Si | Display information about a package in the repositories |
yareps | yaourt -Ss | Search for packages in the repositories |
yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases |
yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases |
yaupd | yaourt -Sy | Update and refresh the local package database |
yaupg | yaourt -Syua | Sync with repositories before upgrading all packages (from AUR too) |
yasu | yaourt -Syua --no-confirm | Same as yaupg , but without confirmation |
upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
- Changed: the setting TWITTER_USE_PERMALINK has been removed and replaced by a placeholder ${permalink}.
- Major bug fix: URL length were calculated using their actual length instead of t.co length.
- Minor bug fix: Support multibytes string split (e.g. don't truncate emoji).