Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb | |
# Maps logical Rails types to MySQL-specific data types. | |
def type_to_sql(type, limit = nil, precision = nil, scale = nil) | |
return super unless type.to_s == 'integer' | |
case limit | |
when 1; 'tinyint' | |
when 2; 'smallint' | |
when 3; 'mediumint' | |
when nil, 4, 11; 'int(11)' # compatibility with MySQL default |
# In this example I make difference for 3 urls, this can be messy if you have an URL that is like /posts/whatever/contacts because there is 2 places that will return True (2nd and 3rd li) | |
# So here is the better option for handling this: | |
{% with request.resolver_match.url_name as url_name %} | |
<ul id="menu"> | |
<li class="{% if url_name == 'home' %}active{% endif %}">Home</li> | |
<li class="{% if url_name == 'blog' %}active{% endif %}">Posts</li> | |
<li class="{% if url_name == 'contact' %}active{% endif %}">Contact</li> | |
</ul> |
# CLI | |
sudo apt update -y | |
sudo apt install -y \ | |
git curl \ | |
docker.io docker-buildx \ | |
build-essential pkg-config autoconf bison rustc cargo clang \ | |
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \ | |
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \ | |
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \ | |
rbenv apache2-utils |
#!/usr/bin/env bash | |
# Abort sign off on any error | |
set -e | |
# Start the benchmark timer | |
SECONDS=0 | |
# Repository introspection | |
OWNER=$(gh repo view --json owner --jq .owner.login) |
#!/bin/sh | |
# Automatic SSH jump host for IPv6-only hosts. | |
# Usage in ~/.ssh/config: ProxyCommand ~/.ssh/ipv6proxy <jumphost> %h %p | |
# If a host is reachable via IPv6, a direct connection is made. | |
# Otherwise a jump host is used (which shall support IPv6). | |
if ping6 -c1 $2 >/dev/null 2>&1; then | |
exec nc -6 $2 $3 | |
else | |
exec ssh -q $1 "nc -6 $2 $3" |
#ifdef OLED_ENABLE | |
// Rotate OLED | |
oled_rotation_t oled_init_user(oled_rotation_t rotation) { | |
return OLED_ROTATION_90; | |
} | |
// Animation parameters | |
#define FRAME_DURATION 333 // How long each frame lasts in milliseconds |
using System.Collections.Generic; | |
/// <summary>A Kalman filter implementation for <c>float</c> values.</summary> | |
public class KalmanFilterFloat { | |
//----------------------------------------------------------------------------------------- | |
// Constants: | |
//----------------------------------------------------------------------------------------- | |
public const float DEFAULT_Q = 0.000001f; |
Descargar esta hoja de atajos: Guías de atajos - Angular
<?php | |
/** | |
* Callback function for taxonomy meta boxes | |
* | |
* A simple callback function for 'meta_box_cb' argument | |
* inside register_taxonomy() that replaces the regular | |
* checkboxes with a plain dropdown list | |
* | |
* @param [type] $post [description] | |
* @param [type] $box [description] |