Skip to content

Instantly share code, notes, and snippets.

/***
* 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 February 18, 2017 15:38
PHP snippets for VS Code
{
/*
// 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 February 19, 2017 03:30
My VS Code settings
// 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,
this.restService
.getResource('/some-end-point')
.subscribe((data) => {
// do stuff with data
});
private fetchAssets() {
this.apollo.watchQuery<{}>({
query: this.assetsQuery
})
.valueChanges
.subscribe(({ data }) => {
this.assets = data.assets;
});
}
this.menuGenerator.make().subscribe(menu: Menu => {
this.globalService.sideMenu = menu;
});
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);
});
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My First PJS</title>
</head>
<body>
</body>
</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>
{
"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",