trait bound fonksiyon tanimi(static dispatch):
fn foo<T: MyTrait>(f: &T) {}Static type dispach yapar. foo(inek), foo(koyun) gibi cagirdigimizda compile time'da iki ayri fn generate edilir.
| function formatMoney(n) { | |
| return parseFloat(n).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1.').replace(/\.(\d+)$/,',$1'); | |
| } | |
| formatMoney(1234567) // 1.234.567,00 | |
| formatMoney(1234567.99) // 1.234.567,99 | |
| #!/bin/bash | |
| # exit on error | |
| set -e | |
| CONF_DIR=~/.kube/config.d | |
| require() { | |
| if ! hash "$1" &>/dev/null; then |
| #!/bin/bash | |
| # alias kctx="source ~/.bin/kctx.sh" | |
| CONF_DIR=~/.kube/config.d | |
| file=$(ls -1 $CONF_DIR | fzf) | |
| echo "$file" | |
| if [[ ! "$file" == "null" ]]; then |
| $.ajaxSetup({ | |
| complete: function(xhr, status) { | |
| if(xhr.status == 278) { | |
| if (xhr.responseJSON) { | |
| var data = xhr.responseJSON; | |
| if (!data.success && data.error_message) { | |
| alert(data.error_message); | |
| } | |
| } |
https://gist.github.com/rgreenjr/3637525
SELECT
pid,
| # .... | |
| # Run script if not running. | |
| if ! pidof -x "catch_window_change.sh" > /dev/null; then | |
| (~/bin/catch_window_change.sh > /dev/null 2>&1 &) | |
| fi |
| <div class="canvas-con"> | |
| <div class="canvas-con-inner"> | |
| <canvas id="mychart" height="250px"></canvas> | |
| </div> | |
| <div id="my-legend-con" class="legend-con"></div> | |
| </div> |
| // formatter adds default fields to each log entry. https://github.com/sirupsen/logrus/pull/653#issuecomment-454467900 | |
| type formatter struct { | |
| Fields logrus.Fields | |
| Lf logrus.Formatter | |
| } | |
| // Format satisfies the logrus.Formatter interface. | |
| func (f *formatter) Format(e *logrus.Entry) ([]byte, error) { | |
| for k, v := range f.Fields { | |
| e.Data[k] = v |
| use actix_service::{Service, Transform}; | |
| use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error}; | |
| use futures::future::{ok, Ready}; | |
| use futures::{Future}; | |
| use slog::info; | |
| use futures::task::Poll; | |
| use std::task::Context; | |
| use std::pin::Pin; | |