Skip to content

Instantly share code, notes, and snippets.

@ynonp
ynonp / clojurescript-useeffect.cljs
Created February 18, 2022 18:42
ClojureScript useEffect example
(ns reagent-useeffect-demo.core
(:require
[reagent.core :as r]
[react :as react]
[cljs.core.async :refer [go]]
[cljs.core.async.interop :refer-macros [<p!]]
[reagent.dom :as rdom]))
(defn use-pokemon [id]
(let [[data set-data] (react/useState {})
@ynonp
ynonp / 01_syntax_review.md
Last active January 19, 2024 09:41
Python Exercises

Learn Python With Me

My (hebrew speaking) Python course is available online at: https://www.tocode.co.il/bundles/python

If you speak the language be sure to drop by and say hello.

Syntax Review

  1. Write a program that asks the user for a number (integer only) and prints the sum of its digits
@ynonp
ynonp / main.cpp
Created December 27, 2013 15:14
QProcess output example
#include <QCoreApplication>
#include <QtCore/QtCore>
#include "monitor.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QProcess p;
p.start("/bin/ls");

Lab: Hello Vue

[ ] Create a first Vue app in Vite. Change the text to show your name.

[ ] Change the background color to a color you like

[ ] Add a new component that prints Hello <your name>. Add it to the page multiple times to see the message repeated.

[ ] Add a new component that shows an image.

@ynonp
ynonp / starter.py
Created July 27, 2023 14:02
generator-send-part1
import random
import sys
from typing import NewType
BPResult = tuple[int, int]
BPNumber = NewType('BPNumber', int)
ALL_OPTIONS = [n for n in range(1000, 99999) if len(str(n)) == len(set(str(n)))]
def guesses():
@ynonp
ynonp / 01-syntax-lab.md
Last active July 27, 2023 12:24
01-syntax

Python Syntax Exercises

  • Create a Python program that asks the user to tyep their age in years, and the program will convert and print their age in months.

  • Create a Python program that asks the user to type their age in months, and the program will convert and print their age in years.

  • Create a Python program to check the complexity of a password: It should ask the user for a word and verify the word contains a lowercase letter, an uppercase letter and a number.

  • Write a Python program that takes a number from the user and print the word "Boom" if that number divides by 7 or contains the digit 7

@ynonp
ynonp / lab01.md
Last active November 15, 2022 09:43

Part 1: Welcome to Unix

  1. Login to your Unix account
  2. Find your current shell, the default shell and a list of all installed shells.
  3. List all files and directories in /etc folder ordered by size (hint: man ls).
  4. Print the current date and time formatted as follows:
    Sun 21/03/2010, 14:30 (hint: man date)

Unix Commands Summary

evenings_ok=(
"Pesach I"
"Pesach VII"
"Shavuot I"
"Tish'a B'Av"
"Rosh Hashana II"
"Yom Kippur"
"Sukkot I"
"Shmini Atzeret"
)
@ynonp
ynonp / create.js
Created January 28, 2013 17:36
mongoose relationships
var mongoose = require('mongoose');
mongoose.connect('localhost/test');
var Schema = mongoose.Schema;
var AlbumSchema = new Schema({
artist: { type: Schema.Types.ObjectId, ref: 'Artist' },
name: String,
year: Number,
CREATE TABLE test (x integer, y integer);
INSERT INTO test(x, y) VALUES(10, 20);
INSERT INTO test(x, y) VALUES(10, 20);
INSERT INTO test(x, y) VALUES(10, 20);