snippetpkg 1.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/1up.js +21 -0
- data/CONTRIBUTING.md +47 -0
- data/FUNDING.yml +2 -0
- data/README.md +55 -0
- data/addLanguage.js +23 -0
- data/bash.bat +11 -0
- data/package-lock.json +102 -0
- data/package.json +53 -0
- data/publish.bat +6 -0
- data/snippet-1.1.29.gem +0 -0
- data/snippet.gemspec +18 -0
- data/snippet_log.js +14 -0
- data/snippets-1.1.29.gem +0 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 59fb650ce7dfbe85ab7d1c06f48632a84651c62875c83c8961cd6e69c7600349
|
4
|
+
data.tar.gz: 342abd9361c4f09071068bbdcb4e9a6b027ecb68626f24c01119ecfc66cb6c41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 99706d6e9c61ebcb852bc3624d56f2fdae1aa0ff35b9b373d99dc5622d269480305e9806f94510dd91ab688e8b5f3374182458eb5b50dca2bd5d971b2686f339
|
7
|
+
data.tar.gz: e73800abf36e8a80dc841a7ccd2a04350fafc1954972deedee82769e020d28b8828d9d89fe169e9efc92bdf0aa63d18f22ceb4964837dec58d9da4fb03f25f41
|
data/1up.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
var fs = require('fs');
|
2
|
+
|
3
|
+
var jsonObj = fs.readFileSync('./package.json').toString();
|
4
|
+
jsonObj = JSON.parse(jsonObj);
|
5
|
+
|
6
|
+
var a = jsonObj.version.split('.'),
|
7
|
+
major = a[0],
|
8
|
+
minor = a[1],
|
9
|
+
release = a[2];
|
10
|
+
|
11
|
+
release = (parseInt(release) + 1).toString();
|
12
|
+
|
13
|
+
var finVer = [
|
14
|
+
major,
|
15
|
+
minor,
|
16
|
+
release
|
17
|
+
].join('.');
|
18
|
+
|
19
|
+
jsonObj.version = finVer;
|
20
|
+
|
21
|
+
fs.writeFileSync('./package.json', JSON.stringify(jsonObj, null, 2));
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
## Contributing to Snippet
|
2
|
+
Thanks for taking the time to contribute to Snippet! ❤️
|
3
|
+
|
4
|
+
Snippet is made to be as community driven as possible, and to help this out, we need the `CONTRIBUTING.md` file to set some ground rules.
|
5
|
+
|
6
|
+
### Table Of Contents
|
7
|
+
- [Contributing](#contributing)
|
8
|
+
- [Testing](#testing)
|
9
|
+
- [Adding a Language](#adding-a-language)
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
On the Snippet GitHub page ([link](https://github.com/opensource-matrix/snippet)), there should be some buttons to the upper right. They should look similar to this:
|
13
|
+
|
14
|
+

|
15
|
+
|
16
|
+
Click on the `Fork` button. It will make your own version of the repository, so you can make whatever changes you wish to make.
|
17
|
+
|
18
|
+
Once you have made your changes, look for the `New Pull Request` button. Click it, confirm everything and your changes should be reviewed within the next 48 hours.
|
19
|
+
|
20
|
+
## Testing
|
21
|
+
Testing your contribution to Snippet is simple, run the `npm test` command.
|
22
|
+
If it exits with code `0`, it's all good to go. I suggest doing your own tests, because the `test` library was not made to function with all programming languages and scripts included in the Snippet library.
|
23
|
+
|
24
|
+
If you don't have `NPM` or `NodeJS` installed, get them from the [NodeJS Website](https://nodejs.org/en/), the first thing you should see on the web page is a download link, get the current version for your system.
|
25
|
+
|
26
|
+
## Adding a Snippet
|
27
|
+
To add a Snippet, open up your file browser and navigate to your Snippet installation path. Open up the `snippets` folder, then select the folder with the language you want to create a snippet for.
|
28
|
+
|
29
|
+
If the language you are looking for doesn't exist, add the folder to the `snippets` folder and call it the name of the said language. Also see [Adding a Language](#adding-a-language) for implementing it.
|
30
|
+
|
31
|
+
Create a file in that folder with the file extension of your language. Change it to your liking, then take a look at the [Contributing](#contributing) section for some help with deploying your changes.
|
32
|
+
|
33
|
+
## Adding a Language
|
34
|
+
To add a language, make sure you have `NodeJS` installed on your computer. If you don't, download it from the [NodeJS Website](https://nodejs.org/en/), now let's get started.
|
35
|
+
|
36
|
+
Open up the terminal of your choice, and enter this command:
|
37
|
+
```
|
38
|
+
node addLanguage.js myAmazingLanguage .myAmazingExtensions .mAE
|
39
|
+
```
|
40
|
+
|
41
|
+
The syntax is built up like this:
|
42
|
+
```
|
43
|
+
node addLanguage.js [language name] [language file extensions (seperated by spaces)]
|
44
|
+
```
|
45
|
+
|
46
|
+
## Outro
|
47
|
+
Good luck with your contributions, developers, I am looking forward to what you all will change on your own versions of Snippet!
|
data/FUNDING.yml
ADDED
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Snippet
|
2
|
+
[](https://travis-ci.com/opensource-matrix/snippet)
|
3
|
+
|
4
|
+
Snippet is a library of code snippets/examples. It's made to show people examples of code that can easily be executed and used.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
Install `Snippet` with `Yarn` or `NPM`:
|
8
|
+
```
|
9
|
+
yarn install @matrixoc/snippet
|
10
|
+
npm install @matrixoc/snippet
|
11
|
+
```
|
12
|
+
|
13
|
+
## Contributing
|
14
|
+
See [CONTRIBUTING.md](//github.com/opensource-matrix/snippet/blob/master/CONTRIBUTING.md).
|
15
|
+
|
16
|
+
## API
|
17
|
+
There is a few functions that package up some helpful methods for use with Snippet.
|
18
|
+
|
19
|
+
```javascript
|
20
|
+
/* Load up the Node module */
|
21
|
+
const snippet = require('@matrixoc/snippet');
|
22
|
+
```
|
23
|
+
|
24
|
+
### Get All Snippets
|
25
|
+
```javascript
|
26
|
+
snippet.getSnippets();
|
27
|
+
```
|
28
|
+
|
29
|
+
### Get All Snippets for a Certain Language
|
30
|
+
```javascript
|
31
|
+
snippet.getSnippetsByLanguage('javascript');
|
32
|
+
```
|
33
|
+
|
34
|
+
### Get a Snippet By Name
|
35
|
+
```javascript
|
36
|
+
snippet.getSnippetByName('hello_world_js');
|
37
|
+
```
|
38
|
+
|
39
|
+
### Check If a Snippet Exists
|
40
|
+
```javascript
|
41
|
+
snippet.checkName('hello_world_js');
|
42
|
+
```
|
43
|
+
|
44
|
+
### Check If a Language Has Any Snippets
|
45
|
+
```javascript
|
46
|
+
snippet.checkLanguage('javascript');
|
47
|
+
```
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
You may add a Snippet and it will be reviewed within the next 48 hours.
|
51
|
+
|
52
|
+
## Contributors
|
53
|
+
The following is a list of all contributors(a-z);
|
54
|
+
- [astronomize](https://github.com/astronomizedev)
|
55
|
+
- [revelmind](https://github.com/revelmind)
|
data/addLanguage.js
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!usr/bin/env node
|
2
|
+
|
3
|
+
var fs = require('fs'),
|
4
|
+
path = require('path');
|
5
|
+
|
6
|
+
var jsonObj = fs.readFileSync(path.join(__dirname, './src/languages.json')).toString();
|
7
|
+
jsonObj = JSON.parse(jsonObj);
|
8
|
+
|
9
|
+
var args = process.argv;
|
10
|
+
if(path.basename(args[0]) == 'node.exe') {
|
11
|
+
args = args.slice(2);
|
12
|
+
} else {
|
13
|
+
args = args.slice(1);
|
14
|
+
}
|
15
|
+
|
16
|
+
if(!typeof jsonObj[args[0]] == 'undefined') {
|
17
|
+
throw new Error('This language already exists.');
|
18
|
+
process.exit(1);
|
19
|
+
} else {
|
20
|
+
jsonObj[args[0]] = args.slice(1);
|
21
|
+
}
|
22
|
+
|
23
|
+
fs.writeFileSync(path.join(__dirname, './src/languages.json'), JSON.stringify(jsonObj, null, 2));
|
data/bash.bat
ADDED
data/package-lock.json
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
{
|
2
|
+
"name": "@matrixoc/snippet",
|
3
|
+
"version": "1.1.11",
|
4
|
+
"lockfileVersion": 1,
|
5
|
+
"requires": true,
|
6
|
+
"dependencies": {
|
7
|
+
"balanced-match": {
|
8
|
+
"version": "1.0.0",
|
9
|
+
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
10
|
+
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
11
|
+
"dev": true
|
12
|
+
},
|
13
|
+
"brace-expansion": {
|
14
|
+
"version": "1.1.11",
|
15
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
16
|
+
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
17
|
+
"dev": true,
|
18
|
+
"requires": {
|
19
|
+
"balanced-match": "^1.0.0",
|
20
|
+
"concat-map": "0.0.1"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
"colors": {
|
24
|
+
"version": "1.3.3",
|
25
|
+
"resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz",
|
26
|
+
"integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==",
|
27
|
+
"dev": true
|
28
|
+
},
|
29
|
+
"concat-map": {
|
30
|
+
"version": "0.0.1",
|
31
|
+
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
32
|
+
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
33
|
+
"dev": true
|
34
|
+
},
|
35
|
+
"fs.realpath": {
|
36
|
+
"version": "1.0.0",
|
37
|
+
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
38
|
+
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
39
|
+
"dev": true
|
40
|
+
},
|
41
|
+
"glob": {
|
42
|
+
"version": "7.1.4",
|
43
|
+
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
|
44
|
+
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
|
45
|
+
"dev": true,
|
46
|
+
"requires": {
|
47
|
+
"fs.realpath": "^1.0.0",
|
48
|
+
"inflight": "^1.0.4",
|
49
|
+
"inherits": "2",
|
50
|
+
"minimatch": "^3.0.4",
|
51
|
+
"once": "^1.3.0",
|
52
|
+
"path-is-absolute": "^1.0.0"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
"inflight": {
|
56
|
+
"version": "1.0.6",
|
57
|
+
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
58
|
+
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
59
|
+
"dev": true,
|
60
|
+
"requires": {
|
61
|
+
"once": "^1.3.0",
|
62
|
+
"wrappy": "1"
|
63
|
+
}
|
64
|
+
},
|
65
|
+
"inherits": {
|
66
|
+
"version": "2.0.4",
|
67
|
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
68
|
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
69
|
+
"dev": true
|
70
|
+
},
|
71
|
+
"minimatch": {
|
72
|
+
"version": "3.0.4",
|
73
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
74
|
+
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
75
|
+
"dev": true,
|
76
|
+
"requires": {
|
77
|
+
"brace-expansion": "^1.1.7"
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"once": {
|
81
|
+
"version": "1.4.0",
|
82
|
+
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
83
|
+
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
84
|
+
"dev": true,
|
85
|
+
"requires": {
|
86
|
+
"wrappy": "1"
|
87
|
+
}
|
88
|
+
},
|
89
|
+
"path-is-absolute": {
|
90
|
+
"version": "1.0.1",
|
91
|
+
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
92
|
+
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
93
|
+
"dev": true
|
94
|
+
},
|
95
|
+
"wrappy": {
|
96
|
+
"version": "1.0.2",
|
97
|
+
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
98
|
+
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
99
|
+
"dev": true
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
data/package.json
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
{
|
2
|
+
"name": "@matrixoc/snippet",
|
3
|
+
"description": "A library of code snippets.",
|
4
|
+
"version": "1.1.29",
|
5
|
+
"main": "./package/package.js",
|
6
|
+
"devDependencies": {
|
7
|
+
"colors": "^1.3.3",
|
8
|
+
"glob": "^7.1.4"
|
9
|
+
},
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "https://github.com/opensource-matrix/snippet.git"
|
13
|
+
},
|
14
|
+
"bugs": {
|
15
|
+
"url": "https://github.com/opensource-matrix/snippet/issues",
|
16
|
+
"email": "uiysgamer@gmail.com"
|
17
|
+
},
|
18
|
+
"scripts": {
|
19
|
+
"test": "node ./test/test.js"
|
20
|
+
},
|
21
|
+
"keywords": [
|
22
|
+
"snippet",
|
23
|
+
"snippets",
|
24
|
+
"programming",
|
25
|
+
"language",
|
26
|
+
"languages",
|
27
|
+
"ruby",
|
28
|
+
"node",
|
29
|
+
"nodejs",
|
30
|
+
"javascript",
|
31
|
+
"java"
|
32
|
+
],
|
33
|
+
"files": [
|
34
|
+
"/package",
|
35
|
+
"/snippets",
|
36
|
+
"/src",
|
37
|
+
"/test",
|
38
|
+
".gitignore",
|
39
|
+
".npmignore",
|
40
|
+
"publish.bat",
|
41
|
+
"package.json",
|
42
|
+
"1up.js",
|
43
|
+
"package-lock.json",
|
44
|
+
"README.md",
|
45
|
+
"snippet_log.js",
|
46
|
+
"addLanguage.js",
|
47
|
+
"CONTRIBUTING.md",
|
48
|
+
"/assets"
|
49
|
+
],
|
50
|
+
"bin": {
|
51
|
+
"create_language": "./addLanguage.js"
|
52
|
+
}
|
53
|
+
}
|
data/publish.bat
ADDED
data/snippet-1.1.29.gem
ADDED
Binary file
|
data/snippet.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
file = File.open('./package.json')
|
4
|
+
file = file.read
|
5
|
+
version = JSON.parse(file)['version']
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'snippetpkg'
|
9
|
+
s.version = version
|
10
|
+
s.licenses = ['MIT']
|
11
|
+
s.summary = "This is an example!"
|
12
|
+
s.description = "Much longer explanation of the example!"
|
13
|
+
s.authors = ["Matrix"]
|
14
|
+
s.email = 'uiysgamer@gmail.com'
|
15
|
+
s.files = Dir.glob("./**")
|
16
|
+
s.homepage = 'https://github.com/opensource-matrix/snippet'
|
17
|
+
s.metadata = { "source_code_uri" => "https://github.com/opensource-matrix/snippet" }
|
18
|
+
end
|
data/snippet_log.js
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
-= Snippet =-
|
3
|
+
Sends a stylized message to the console.
|
4
|
+
*/
|
5
|
+
var colors = require('colors');
|
6
|
+
|
7
|
+
module.exports = function(type, arg) {
|
8
|
+
if(type == 'error') {
|
9
|
+
console.log('[SNIPPET ' + '!ERR'.red + ']' + arg)
|
10
|
+
process.exit(0);
|
11
|
+
} else if(type == 'good') {
|
12
|
+
console.log('[SNIPPET ' + '!OUT'.green + ']' + arg)
|
13
|
+
}
|
14
|
+
}
|
data/snippets-1.1.29.gem
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: snippetpkg
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.29
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matrix
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Much longer explanation of the example!
|
14
|
+
email: uiysgamer@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- "./1up.js"
|
20
|
+
- "./CONTRIBUTING.md"
|
21
|
+
- "./FUNDING.yml"
|
22
|
+
- "./README.md"
|
23
|
+
- "./addLanguage.js"
|
24
|
+
- "./bash.bat"
|
25
|
+
- "./package-lock.json"
|
26
|
+
- "./package.json"
|
27
|
+
- "./publish.bat"
|
28
|
+
- "./snippet-1.1.29.gem"
|
29
|
+
- "./snippet.gemspec"
|
30
|
+
- "./snippet_log.js"
|
31
|
+
- "./snippets-1.1.29.gem"
|
32
|
+
homepage: https://github.com/opensource-matrix/snippet
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata:
|
36
|
+
source_code_uri: https://github.com/opensource-matrix/snippet
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 2.7.6.2
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: This is an example!
|
57
|
+
test_files: []
|