Skip to content

Instantly share code, notes, and snippets.

View NateWeiler's full-sized avatar

Nathan Weiler NateWeiler

View GitHub Profile
<!-- Example detects the arrow key by adding a eventListener(keydown) to the body by using event.key. -->
<!DOCTYPE html>
<html>
<head>
<title>JavaScript | Detecting arrow key presses.</title>
</head>
<body style="text-align:center;" id="body">
<h1 style="color:green;">Arrow Key Event Listener Keydown to Body</h1>
<p id="GFG_UP" style="font-size: 16px;">Press an arrow key and click the button to know which key was pressed last time.</p>
<button onclick="gfg_Run()">Detect Arrow key</button>
<!-- Example that detects the arrow key by onkeydown Event by using event.keyCode. -->
<!DOCTYPE html>
<html>
<head>
<title>JavaScript | Detecting arrow key presses.</title>
</head>
<body style="text-align:center;" id="body">
<h1 style="color:green;">JavaScript | Detecting arrow key presses.</h1>
<p id="GFG_UP" style="font-size: 16px;"> Press an arrow key and click the last time.</p>
<button onclick="gfg_Run()">Detect Arrow key</button>
<!-- Example detects the arrow key by adding a eventListener(keydown) to the body by using event.key. -->
<!DOCTYPE html>
<html>
<head>
<title>JavaScript | Detecting arrow key presses</title>
</head>
<body style="text-align:center;" id="body">
<h1 style="color:green;">JavaScript | Detecting arrow key presses</h1>
<p id="GFG_UP" style="font-size: 16px;">Press an arrow key and click the button to know which key was pressed last time.</p>
<button onclick="gfg_Run()">Detect Arrow key</button>
<!--
How to disable arrow key in textarea using JavaScript.
Given an HTML element containing the <textarea> element
and the task is to disable scrolling through arrow
keys with the help of JavaScript.
Approach 1
-->
<!DOCTYPE HTML>
<html>
<head>
#!/bin/bash
# your target file
CONFIG=./config.txt
# comment target
comment() {
sed -i '' "s/^$1/#$1/" $CONFIG
}
import "package:flutter/material.dart";
import 'package:flutter/services.dart';
import 'dart:math';
const CURVE_HEIGHT = 160.0;
const AVATAR_RADIUS = CURVE_HEIGHT * 0.28;
const AVATAR_DIAMETER = AVATAR_RADIUS * 2;
void main() => runApp(new MyApp());

Mastering Markdown

  Download PDF version

Markdown is a lightweight and easy-to-use syntax for styling all forms of writing on the GitHub platform.

What you will learn:

  • How the Markdown format makes styled collaborative editing easy

Creating Gists


You can create two kinds of gists: public and secret. Create a public gist if you're ready to share your ideas with the world or a secret gist if you're not.

Every gist is a Git repository, which means that it can be forked and cloned. If you are signed in to GitHub when you create a gist, the gist will be associated with your account and you will see it in your list of gists when you navigate to your gist home page.

Gists can be public or secret. Public gists show up in Discover, where people can browse new gists as they're created. They're also searchable, so you can use them if you'd like other people to find and see your work. After creating a gist, you cannot convert it from public to secret.

Secret gists don't show up in Discover and are not searchable. After creating a gist, you cannot convert it from public to secret. Secret gists aren't private. If you send the URL of a secret gist to a friend, they'll be able to see it. However, if someone you don't know discovers the URL, t

let request = require('request')
, path = require('path')
, fs = require('fs')
, url = "https://api.github.com/users/thomastraum/gists"
, savepath = './gists';
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {