Skip to content

Instantly share code, notes, and snippets.

View SmoothScroll.js
/***
* Allows for smooth scrolling when navigating to an on-page anchor.
*
* @requires: jQuery
*/
$(function(){
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
@DanJFletcher
DanJFletcher / php.json
Created Feb 18, 2017
PHP snippets for VS Code
View php.json
{
/*
// Place your snippets for PHP here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
@DanJFletcher
DanJFletcher / settings.json
Created Feb 19, 2017
My VS Code settings
View settings.json
// Place your settings in this file to overwrite the default settings
{
// Editor
// Columns at which to show vertical rulers
"editor.rulers": [80],
// Controls after how many characters the editor will wrap to the next line. Setting this to 0 turns on viewport width wrapping (word wrapping). Setting this to -1 forces the editor to never wrap.
"editor.wrappingColumn": 0,
View rxjs-medium-rest-example.js
this.restService
.getResource('/some-end-point')
.subscribe((data) => {
// do stuff with data
});
View rxjs-medium-apollo-example.js
private fetchAssets() {
this.apollo.watchQuery<{}>({
query: this.assetsQuery
})
.valueChanges
.subscribe(({ data }) => {
this.assets = data.assets;
});
}
View rxjs-medium-menu-generator-example.js
this.menuGenerator.make().subscribe(menu: Menu => {
this.globalService.sideMenu = menu;
});
View rxjs-medium-menu-generator-example-1.js
public function make(): Menu {
this.apollo.watchQuery<{}>({
query: mainNavigationQuery
})
.valueChanges
.subscribe({ data } => {
// build the menu object from data and return the result
return this.build(data);
});
}
View processing-js-khan-academy.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My First PJS</title>
</head>
<body>
</body>
</html>
View processing-js-khan-academy-2.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My First PJS</title>
</head>
<body>
<canvas id="my-canvas"></canvas>
</body>
</html>
View vscode-launch-config-for-netlify-functions.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Netlify Debugging",
"type": "pwa-node",
"request": "launch",
"program": "${workspaceFolder}\\node_modules\\.bin\\netlify",
"runtimeArgs": ["run-script", "debug"],
"runtimeExecutable": "npm",