Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin kevinquillen

View GitHub Profile
View the_skills_poor_programmers_lack.md

The Skills Poor Programmers Lack

02/22/2019

Updated: 04/27/2020

A friend and I had a discussion about the basic skills that are often lacking in experienced programmers. How can a programmer work for ten or twenty years and never learn to write good code? Too often they need close supervision to ensure they go down the right path, and can never be trusted to take technical leadership on larger tasks. It seems they are just good enough to get by in their job, but they never become effective.

We thought about our experiences and came up with three fundamental skills that we find are most often missing. Note that these are not skills which take a considerable amount of talent or unique insight. Nor are they "trends" or "frameworks" to help you get a new job. They are basic fundamentals which are prerequisites to being a successful programmer.

@chriscalip
chriscalip / xxx.drush.inc
Last active Mar 6, 2019
Demo of `drush-update-assets-via-csv`
View xxx.drush.inc
<?php
/**
* Command callback. drush update-assets-via-csv
*/
function drush_capacitype_deploy_update_assets_via_csv() {
$source_csv = (!is_null(drush_get_option('csv'))) ? drush_get_option('csv') : '';
if (empty($source_csv)) {
drush_print_r('Expected parameter, csv not found.');
return;
@florentdestremau
florentdestremau / NewPasswordType.php
Last active Sep 17, 2021
A simple User authentication setup to copy & paste into your Symfony 3.4 install
View NewPasswordType.php
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
@taufek
taufek / pre-push
Last active Sep 27, 2021
PrePush Git Hook with PhpCs and PhpStan
View pre-push
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
exec < /dev/tty
@svetlio
svetlio / SerializerCount.php
Last active Feb 12, 2020
Drupal 8 views rest with pager data
View SerializerCount.php
<?php
// thanks Dan - http://www.mediacurrent.com/blog/eight-insights-and-useful-snippets-d8-rest-module
/** @file
* Contains \Drupal\views_ext\Plugin\views\style\SerializerCount.
*/
namespace Drupal\views_ext\Plugin\views\style;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
@lxhunter
lxhunter / semver.sh
Last active Mar 22, 2021
Automated semantic versioning for travis-ci or any other ci
View semver.sh
#!/bin/bash
export SEMVER_LAST_TAG=$(git describe --abbrev=0 --tags 2>/dev/null)
export SEMVER_RELEASE_LEVEL=$(git log --oneline -1 --pretty=%B | cat | tr -d '\n' | cut -d "[" -f2 | cut -d "]" -f1)
#curl -o /tmp/hub.tgz https://github.com/github/hub/releases/download/v2.2.9/hub-linux-arm64-2.2.9.tgz
#tar -xvzf /tmp/hub.tgz -C /tmp
if [ -z $SEMVER_LAST_TAG ]; then
>&2 echo "No tags defined"
@mikecrittenden
mikecrittenden / get_node_by_path.php
Created Sep 16, 2016 — forked from thagler/get_node_by_path.php
Drupal 8 Get node ID by path alias
View get_node_by_path.php
<?php
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias');
if(preg_match('/node\/(\d+)/', $path, $matches)) {
$node = \Drupal\node\Entity\Node::load($matches[1]);
}
View addressmappings.yml
'field_address/country_code':
plugin: default_value
default_value: US
'field_address/langcode':
plugin: default_value
default_value: en
'field_address/address_line1': streetAddress
'field_address/locality': city
# This has the form US-IN.
'field_address/administrative_area':
@subfuzion
subfuzion / curl.md
Last active Dec 3, 2021
curl POST examples
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@kevinquillen
kevinquillen / module.php
Last active Jul 10, 2017
Importing to a SQL table from a CSV file in Drupal, so you don't have to parse exceptionally large CSVs line by line and instead can do so with MySQL querying. This snippet assumes you have read the column headers already from the CSV and passed them as parameters, as well as the temp table name you want to use.
View module.php
<?php
/**
* Creates a temporary table to hold values from an uploaded CSV.
* @param $table_name
* @param $columns
* @param $message
* @param $context
*/
function csv_import_create_temp_table($table_name, $columns) {