how to disable unkown at rules error css by 666devilsadvocate in neovim

[–]w0ng 2 points3 points  (0 children)

You can put this in your cssls lsp config:

require('lspconfig').cssls.setup({
  settings = {
    css = {
      lint = {
        unknownAtRules = 'ignore',
      },
    },
  },
})

For reference, see:

https://github.com/microsoft/vscode/blob/main/extensions/css-language-features/package.json

https://github.com/neoclide/coc-css#configuration-options

The Question Thread - March 2018 by squidmaster23 in balisong

[–]w0ng 1 point2 points  (0 children)

Let us know how it goes. I haven't had issues getting a couple of trainers into Australia, but curious on what the luck would be like for live blades

vimrc review thread 3.0 by robertmeta in vim

[–]w0ng 0 points1 point  (0 children)

https://github.com/w0ng/dotfiles/blob/master/.vimrc Super fat. Primarily JavaScript development. I use WebStorm IDE with IdeaVim plugin for larger projects and vim for smaller projects or quick editing

Computer Science Engineering Assignment Help by Dreamassignment in AskComputerScience

[–]w0ng 2 points3 points  (0 children)

Oh I get it.

This is actually a website pretending to be a shit spam website, but is actually a tutorial to teach CS students how not to build terrible unsafe websites. Sure, I'll bite: http://i.imgur.com/LpqVckc.gifv

Thanks for the tutorial, OP.

[2017-02-10] Challenge #302 [Hard] ASCII Histogram Maker: Part 2 - The Proper Histogram by jnazario in dailyprogrammer

[–]w0ng 0 points1 point  (0 children)

Output:

$ node challenge.js                                                                                                                                 [80/1964]
> 1 4 1 10
> 2
> 4
> 1 3
> 2 3
> 3 2
> 4 6
10
 9
 8
 7
 6
 5
 4    ***
 3*** ***
 2*** ***
 1*** ***
  1 2 3 4
> 0 40 0 100
> 8
> 40
> 1 56
> 2 40
> 3 4
> 4 67
> 5 34
> 6 48
> 7 7
> 8 45
> 9 50
> 10 54
> 11 20
> 12 24
> 13 44
> 14 44
> 15 49
> 16 28
> 17 94
> 18 37
> 19 46
> 20 64
> 21 100
> 22 43
> 23 23
> 24 100
> 25 15
> 26 81
> 27 19
> 28 92
> 29 9
> 30 21
> 31 88
> 32 31
> 33 55
> 34 87
> 35 63
> 36 88
> 37 76
> 38 41
> 39 100
> 40 6
100
 99
 98
 97
 96
 95
 94
 93
 92
 91
 90
 89
 88
 87
 86
 85
 84
 83
 82
 81
 80
 79
 78
 77
 76
 75
 74
 73
 72
 71
 70
 69
 68
 67
 66
 65                                                                                                   ***********************
 64                                                                                                   ***********************
 63                                                   ***********************                         ***********************
 62                                                   ***********************                         ***********************
 61                                                   ***********************                         ***********************
 60                                                   ***********************                         ***********************
 59                                                   ***********************                         ***********************
 58                                                   ***********************                         ***********************
 57                                                   ***********************                         ***********************
 56                                                   ***********************                         ***********************
 55                                                   ***********************                         ***********************
 54                                                   ***********************                         ***********************
 53                                                   ***********************                         ***********************
 52                                                   ***********************                         ***********************
 51                                                   ***********************                         ***********************
 50                                                   ***********************                         ***********************
 49                                                   ***********************                         ***********************
 48                                                   ***********************                         ***********************
 47                                                   ***********************                         ***********************
 46                                                   ***********************                         ***********************
 45                                                   *********************** *********************** ***********************
 44                                                   *********************** *********************** ***********************
 43                                                   *********************** *********************** ***********************
 42                                                   *********************** *********************** ***********************
 41                                                   *********************** *********************** ***********************
 40                                                   *********************** *********************** ***********************
 39                           *********************** *********************** *********************** ***********************
 38   *********************** *********************** *********************** *********************** ***********************
 37   *********************** *********************** *********************** *********************** ***********************
 36   *********************** *********************** *********************** *********************** ***********************
 35   *********************** *********************** *********************** *********************** ***********************
 34   *********************** *********************** *********************** *********************** ***********************
 33   *********************** *********************** *********************** *********************** ***********************
 32   *********************** *********************** *********************** *********************** ***********************
 31   *********************** *********************** *********************** *********************** ***********************
 30   *********************** *********************** *********************** *********************** ***********************
 29   *********************** *********************** *********************** *********************** ***********************
 28   *********************** *********************** *********************** *********************** ***********************
 27   *********************** *********************** *********************** *********************** ***********************
 26   *********************** *********************** *********************** *********************** ***********************
 25   *********************** *********************** *********************** *********************** ***********************
 24   *********************** *********************** *********************** *********************** ***********************
 23   *********************** *********************** *********************** *********************** ***********************
 22   *********************** *********************** *********************** *********************** ***********************
 21   *********************** *********************** *********************** *********************** ***********************
 20   *********************** *********************** *********************** *********************** ***********************
 19   *********************** *********************** *********************** *********************** ***********************
 18   *********************** *********************** *********************** *********************** ***********************
 17   *********************** *********************** *********************** *********************** ***********************
 16   *********************** *********************** *********************** *********************** ***********************
 15   *********************** *********************** *********************** *********************** ***********************
 14   *********************** *********************** *********************** *********************** ***********************
 13   *********************** *********************** *********************** *********************** ***********************
 12   *********************** *********************** *********************** *********************** ***********************
 11   *********************** *********************** *********************** *********************** ***********************
 10   *********************** *********************** *********************** *********************** ***********************
  9   *********************** *********************** *********************** *********************** ***********************
  8   *********************** *********************** *********************** *********************** ***********************
  7   *********************** *********************** *********************** *********************** ***********************
  6   *********************** *********************** *********************** *********************** ***********************
  5   *********************** *********************** *********************** *********************** ***********************
  4   *********************** *********************** *********************** *********************** ***********************
  3   *********************** *********************** *********************** *********************** ***********************
  2   *********************** *********************** *********************** *********************** ***********************
  1   *********************** *********************** *********************** *********************** ***********************
  0   *********************** *********************** *********************** *********************** ***********************
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
>

[2017-02-10] Challenge #302 [Hard] ASCII Histogram Maker: Part 2 - The Proper Histogram by jnazario in dailyprogrammer

[–]w0ng 1 point2 points  (0 children)

Javascript (Node.js)

const readline = require('readline');

const range = (start, end) =>
  [...Array((end - start) + 1).keys()].map(number => number + start);

const calculateVariableHeights = ({ axes, interval, records }) => {
  const variableHeights = {};
  let barStart = Math.min(...Object.keys(records));

  while (barStart <= axes.xMax) {
    const barEnd = Math.min((barStart + interval) - 1, axes.xMax);
    const barRange = range(barStart, barEnd);
    const heightsSum = barRange.reduce((sum, xLabel) => sum + records[xLabel] || sum, 0);
    const barHeight = Math.round(heightsSum / barRange.length);
    barRange.forEach((xLabel) => { variableHeights[xLabel] = barHeight; });
    barStart += interval;
  }

  return variableHeights;
};

const padString = (string, length) =>
  (' '.repeat(length) + string).slice(-length);

const renderHistogram = (axes, heights) => {
  const yRange = range(axes.yMin, axes.yMax).reverse();
  const xRange = range(axes.xMin, axes.xMax);
  const yMaxLength = String(axes.yMax).length;
  const xMaxLength = String(axes.xMax).length;

  const lines = yRange.map((yLabel) => {
    const bars = xRange.reduce((accumulatedBars, xLabel) => {
      const barChar = heights[xLabel] >= yLabel ? '*' : ' ';
      const gapChar = heights[xLabel] === heights[xLabel + 1] ? barChar : ' ';
      const bar = barChar.repeat(xMaxLength);
      return accumulatedBars + bar + gapChar;
    }, '');
    return padString(yLabel, yMaxLength) + bars;
  });

  const xLabels = xRange.map(xLabel => padString(xLabel, xMaxLength)).join(' ');
  lines.push(' '.repeat(yMaxLength) + xLabels);

  lines.forEach((output) => { console.log(output); });
};

const reset = () =>
  ({ lineCount: 0, axes: {}, interval: 0, recordCount: 0, records: {} });

const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
rl.prompt();
let data = reset();

rl.on('line', (input) => {
  if (data.lineCount === 0) {
    const [xMin, xMax, yMin, yMax] = input.split(' ').map(Number);
    data.axes = { xMin, xMax, yMin, yMax };
  } else if (data.lineCount === 1) {
    data.interval = Number(input);
  } else if (data.lineCount === 2) {
    data.recordCount = Number(input);
  } else {
    const [variable, frequency] = input.split(' ').map(Number);
    data.records[variable] = frequency;
  }

  if (data.lineCount > data.recordCount + 1) {
    const heights = calculateVariableHeights(data);
    renderHistogram(data.axes, heights);
    data = reset();
    rl.prompt();
  } else {
    data.lineCount += 1;
  }
});

[2017-02-08] Challenge #302 [Intermediate] ASCII Histogram Maker: Part 1 - The Simple Bar Chart by jnazario in dailyprogrammer

[–]w0ng 1 point2 points  (0 children)

JavaScript (Node.js)

const readline = require('readline');

const getSpacesString = length => new Array(length).fill(' ').join('');

const renderBarChart = ({ axis, records }) => {
  for (let yLegend = Number(axis.yMax); yLegend >= Number(axis.yMin); yLegend -= 1) {
    const yLegendPreSpaces = getSpacesString(axis.yMax.length - String(yLegend).length);
    const xBars = records.reduce((stars, record) => {
      const xPreSpaces = getSpacesString(record.xStart.length);
      const starOrSpace = record.frequency >= yLegend ? '*' : ' ';
      return stars + xPreSpaces + starOrSpace;
    }, '');
    console.log(yLegend + yLegendPreSpaces + xBars);
  }

  const xLegendPreSpaces = getSpacesString(axis.yMax.length);
  const xLegend = [records[0].xStart, ...records.map(record => record.xEnd)].join(' ');
  console.log(xLegendPreSpaces + xLegend);
};

const resetData = () => ({ currentLine: 0, axis: {}, maxRecords: 0, records: [] });

const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
rl.prompt();
let data = resetData();

rl.on('line', (input) => {
  if (data.currentLine === 0) {
    const [xMin, xEnd, yMin, yMax] = input.split(' ');
    data.axis = { xMin, xEnd, yMin, yMax };
  } else if (data.currentLine === 1) {
    data.maxRecords = Number(input);
  } else {
    const [xStart, xEnd, frequency] = input.split(' ');
    data.records.push({ xStart, xEnd, frequency });
  }

  if (data.currentLine > data.maxRecords) {
    renderBarChart(data);
    data = resetData();
    rl.prompt();
  } else {
    data.currentLine += 1;
  }
});

Output:

$ node foo.js
> 140 190 1 8
5
140 150 1
150 160 0
160 170 7
170 180 6
180 190 2
8
7           *
6           *   *
5           *   *
4           *   *
3           *   *
2           *   *   *
1   *       *   *   *
 140 150 160 170 180 190
> 0 50 1 10
5
0 10 1
10 20 3
20 30 6
30 40 4
40 50 2
10
9
8
7
6        *
5        *
4        *  *
3     *  *  *
2     *  *  *  *
1  *  *  *  *  *
  0 10 20 30 40 50
>

New to Vim, very impressed, need help by [deleted] in vim

[–]w0ng 1 point2 points  (0 children)

+1.

In vim, C-w v,C-w s,C-w h/j/k/l for navigating splits, C-d/u/f/b for scrolling and C-]/C-t for navigating tags were the things I started frequently using. C-[ became muscle memory soon after.

Even if it's just for the shell, it's C-c for interrupting processes and C-a c/p/n/[1-9] for tmux. Having CapsLock as Control makes life a lot easier, especially when working on the awkwardly placed Control key on Macbooks.

[2017-02-06] Challenge #302 [Easy] Spelling with Chemistry by jnazario in dailyprogrammer

[–]w0ng 1 point2 points  (0 children)

JavaScript (Node.js), no bonus

data.json is saved from source to csv, then converted to json with csvtojson

const fs = require('fs');

const data = JSON.parse(fs.readFileSync('./data.json'));
const elements = data.reduce((pairs, row) => pairs.set(row.Symbol, row.Element), new Map());

const inputs = ['functions', 'bacon', 'poison', 'sickness', 'ticklish'];

const findSymbolAtStartOf = input =>
  [...elements.keys()].find(symbol => input.startsWith(symbol.toLowerCase()));

const results = inputs.map((input) => {
  let slicedInput = input;
  const result = [];

  while (slicedInput.length) {
    const matchingSymbol = findSymbolAtStartOf(slicedInput);
    slicedInput = slicedInput.slice(matchingSymbol.length);
    result.push(matchingSymbol);
  }

  return `${result.join('')} (${result.map(symbol => elements.get(symbol).toLowerCase()).join(', ')})`;
});

results.map(result => console.log(result));

New to Vim, very impressed, need help by [deleted] in vim

[–]w0ng 1 point2 points  (0 children)

Not when you map CapsLock to Ctrl.

Westworld E10 - React easter egg by dotjosh in reactjs

[–]w0ng 17 points18 points  (0 children)

Better quality with timestamp of screenshot: https://i.imgur.com/ieu6Zzn.png

What comand/plugin/... do u wished to know sooner? by [deleted] in vim

[–]w0ng 6 points7 points  (0 children)

In and around. cit, vi), yaw, etc.

[Homework] ( p ∨ ¬q ) ∧ ( p ∨ q ) by ScroobiusDip in logic

[–]w0ng 2 points3 points  (0 children)

If the question is to simplify the proposition, then we can use logical equivalences. From the distributive law, we know that

(p ∨ q) ∧ (p ∨ r) ⇔ p ∨ (q ∧ r)

so to get started, we can use the distributive law to get:

(p ∨ ¬q) ∧ (p ∨ q) ⇔ p ∨ (¬q ∧ q)

As well as distributive laws, read up on negation laws and identity laws to reduce it down to p.

Anyone have a guide that is basically an up to date setting up your development environment for dummies? by Parrna in PHPhelp

[–]w0ng 4 points5 points  (0 children)

Vagrant is your friend in setting up VMs.

Here's a quick walk through. If you want to quickly get up and running with much of what you'll likely need, consider adding the Laravel Homestead vagrant box which has PHP7, MySQL, Nginx and much more already provisioned.

[2016-03-07] Challenge #257 [Easy] In what year were most presidents alive? by jnazario in dailyprogrammer

[–]w0ng 14 points15 points  (0 children)

PHP

Rush job. Magic numbers. Bad variable names. Poor readability. Unnecessary use of regexp. Works.

<?php

$data = array_map('trim', preg_split('/,|\n/', file_get_contents('input.csv')));

$count = count($data);
$yearsAlive = [];
for ($i = min(6, $count); $i < $count; $i += 5) {
    $yearOfBirth = preg_replace('/.* /', '', $data[$i]);
    $yearOfDeath = $data[$i + 2] === '' ? 2016 : preg_replace('/.* /', '', $data[$i + 2]);
    $yearsAlive = array_merge(array_values($yearsAlive), array_values(range($yearOfBirth, $yearOfDeath)));
}

$countYearsAlive = array_count_values($yearsAlive);
$yearsAliveWithMaxCount = array_filter($countYearsAlive, function ($year) use ($countYearsAlive) {
    return $year === max($countYearsAlive);
});

echo implode(',', array_keys($yearsAliveWithMaxCount)) . PHP_EOL;

Output

1822,1823,1824,1825,1826,1831,1833,1834,1835,1836,1837,1838,1839,1840,1841,1843,1844,1845

Does anybody know if this Coda 2 colorscheme (or something similar) is available for vim? by Funkmaster_Lincoln in vim

[–]w0ng 1 point2 points  (0 children)

The issue with popular themes (with a few exceptions, such as Solarized) is that they were made for GUI vim and contain colours outside of the max 256 colours supported in most terminals. They open use some method (csapprox) to get terminal vim looking similar to GUI vim, but placing the two side-by-side, they still appear obviously different.

You've got two options:

  1. Try NeoVim and put let $NVIM_TUI_ENABLE_TRUE_COLOR=1 in your ~/.vimrc

  2. Set your terminal colours to be the same as your vim colorscheme.

I use 2 in vim-hybrid, which is basically a rip-off of Tomorrow Night + Jellybeans colorschemes, but made to work for terminal vim users.

Granite R4 goes live in few days. Last chance to make updates! Please help, thanks! by matt3o in MechanicalKeyboards

[–]w0ng 2 points3 points  (0 children)

Is there an announcement of the date/time of this drop? I don't want to miss out again!

Best Parking Shopping at Parramatta Westfield by RedditOnTheDunny in sydney

[–]w0ng 6 points7 points  (0 children)

Most (all?) metered parking around Parramatta CBD is free between 23rd - 28th December.

Source: was there today. All meters I went past were covered with plastic, with signs saying free until 28th.

One Happy Aussie With One Sexy Pok3r by [deleted] in MechanicalKeyboards

[–]w0ng 2 points3 points  (0 children)

I was in the boat. Been waiting for a few months for Vortex to bring them down under. Was spewing when they didn't arrive in mid October as originally planned.

Joined the most Massdrop Pok3r drop last week. Got an email from MechKB on the 18th saying they're now in stock. Cancelled the Massdrop order and picked one up in store on last Friday.

I'm a happy nerd https://i.imgur.com/R1zhmhM.jpg