Skip to content

Instantly share code, notes, and snippets.

View dsl2022's full-sized avatar
🏠
Working from home

DSL dsl2022

🏠
Working from home
View GitHub Profile
def flip(string):
print(string[::-1])
flip("A man, a plan, a canal: Panama")

Intro

read this article

Method Path Purpose
GET / Home page
GET /places Places index page
POST /places Create new place
GET /places/new Form page for creating a new place
GET /places/:id Details about a particular place

Activity: Array Iterator Practice 5 Trophy Games is looking to boost their user profile pages and add some perks for different users. The marketing team prefers to have some simple lists of user data requested, and it's your job to get that data to them.

In this activity, we will use the iterators .forEach, .map, and .filter to solve a variety of array-centric challenges.

For each challenge, you will need to determine the best iterator for the job.

For each of the following exercises, use this array as an example of what users could be.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const React = require("react");
const Default = require("./layouts/Default");
function New() {
return (
<Default>
<h2>Add a new bread</h2>
<form action="/breads" method="POST">
<label htmlFor="name">Name</label>
<input type="text" name="name" id="name" required />
apt update && \
apt install -y wget && \
DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y && \
mkdir -p ~/.ssh && \
cd $_ && \
chmod 700 ~/.ssh && \
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII2AOiMJXSWr/yYuAkSur/QSfdwBbmK3hs4qzlMvOQxT dmml@Dmms-MBP" >> authorized_keys && \
service ssh start
@dsl2022
dsl2022 / KeyPressEvent.js
Created January 28, 2022 05:42 — forked from newvertex/KeyPressEvent.js
Example: Detect keypress event in Node.js console app
var readline = require('readline');
readline.emitKeypressEvents(process.stdin);
if (process.stdin.isTTY)
process.stdin.setRawMode(true);
process.stdin.on('keypress', (chunk, key) => {
if (key && key.name == 'q')
process.exit();
@dsl2022
dsl2022 / markdown-details-collapsible.md
Created December 30, 2021 21:00 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
const compress = (str) => {
let result = []
let i = 0;
let j = 0;
while(j <= str.length){
if(str[i]===str[j]){
j+=1
}else{
const num = j-i
if(num===1){
const compress = (s) => {
let result=[]
const strArr = s.split('')
const strMap = strArr.reduce((acc,param)=>{
if(!acc[param]){
acc[param]=1
return acc
}
acc[param]++
return acc