What is the output of this code?
var a = 5; // (1)
!function(x) { // (2)
a = x; // (3)
}(7); // (4)
console.log(a); // a = 7 (5)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import argv | |
import re | |
# open the file and get read to read data | |
file = open(argv[1], "r"); | |
p = re.compile("\d+"); | |
# initialize the graph | |
vertices, edges = map(int, p.findall(file.readline())) | |
graph = [[0]*vertices for _ in range(vertices)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const exec = require('child_process').exec; | |
/* | |
const createDirectory = dirPath => { | |
const targetFolder = '/dist'; | |
fs.mkdirSync(process.cwd() + (dirPath + targetFolder), { recursive: true }, (error) => { | |
if(error) { | |
console.error(error.message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SOURCE: @zhouyanlt https://gist.github.com/yevrah/21cdccc1dc65efd2a4712781815159fb#gistcomment-2695800 | |
sudo yum install -y gcc git ncurses-devel | |
git clone https://github.com/vim/vim.git ~/vim | |
cd ~/vim/src | |
make distclean # if you built Vim before | |
make -j8 | |
sudo make install | |
cp -ru ~/vim/src/vim /usr/bin # overwrites /usr/bin/vim w/o confirmation |
There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore
is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules
directory) as well as files that are generated (and regenerated) as artifacts of a build process.
All other files should be in your own global gitignore file. Create a file called .gitignore
in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.
git config --global core.excludesfile ~/.gitignore
git config --global core.excludesfile %USERPROFILE%\.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 'something' ] | |
[ 'something', 'soothing' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
var natural = require('natural'); | |
var corpus = ['something', 'soothing']; | |
var spellcheck = new natural.Spellcheck(corpus); | |
console.log(spellcheck.getCorrections('soemthing', 1)); | |
console.log(spellcheck.getCorrections('soemthing', 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
They sound alike! | |
FNTKS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
var natural = require('natural'); | |
var metaphone = natural.Metaphone; | |
var soundEx = natural.SoundEx; | |
var wordA = 'phonetics'; | |
var wordB = 'fonetix'; | |
if (metaphone.compare(wordA, wordB)) |
NewerOlder