Skip to content

Instantly share code, notes, and snippets.

View endo64's full-sized avatar
🏠

Semseddin Moldibi endo64

🏠
View GitHub Profile
@pbojinov
pbojinov / README.md
Last active November 5, 2024 03:29
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@greggirwin
greggirwin / arity-of.red
Last active April 12, 2021 17:47
Red arity-of function
; We have other reflective functions (words-of, body-of, etc.), but
; this is a little higher level, sounded fun to do, and may prove
; useful as we write more Red tools. It also shows how to make your
; own typesets and use them when parsing.
arity-of: function [
"Returns the fixed-part arity of a function spec"
spec [any-function! block!]
/with refs [refinement! block!] "Count one or more refinements, and add their arity"
][
@toomasv
toomasv / dir-tree.red
Last active January 6, 2022 11:30
Print a directory tree
Red [
Author: "Toomas Vooglaid"
Date: "2017-05-07"
Changed: "2018-07-09"
Purpose: "Print a directory tree"
File: "%dir-tree.red"
]
context [
; Some helpers
get-char: func [hex][to-char to-integer hex]
@greggirwin
greggirwin / red-object-browser.red
Last active October 16, 2020 17:48
Red Object Browser
Red [
title: "Red Object Browser"
author: "Gregg Irwin"
needs: 'View
]
e.g.: :comment
map-ex: func [
"Evaluates a function for all values in a series and returns the results."
@dander
dander / generators.red
Last active August 27, 2020 07:29
An experiment to make a general purpose generator-creating function
Red [
Title: "generator function experiments"
Author: "Dave Andersen"
Date: 27-Sep-2017
]
reload: does [do system/options/script]
; @JacobGood's closure func
closure1: func [
@dockimbel
dockimbel / parse-info.red
Last active October 24, 2017 08:46
Function to get stats about internal parse states usage for a given parsing job.
Red [
Title: "Parse Info"
Purpose: {
Provides some stats about internal parse states usage for a given parsing job.
Could be used as a way to compare efficiency of different parsing strategies.
}
Date: 06-Oct-2017
]
context [
@greggirwin
greggirwin / profile.red
Last active December 28, 2020 06:17
Basic profiling for Red code comparisons
Red []
e.g.: :comment
delta-time: function [
"Return the time it takes to evaluate a block"
code [block! word! function!] "Code to evaluate"
/count ct "Eval the code this many times, rather than once"
][
ct: any [ct 1]
@toomasv
toomasv / conversion-lab.red
Last active May 9, 2018 10:55
Experiment with conversions
Red [
Needs: View
Author: "Toomas Vooglaid"
Date: 2018-01-12
Purpose: {To study conversions between datatypes}
]
ctx: context [
types: compose [
hex #00000001
local-file "file.red"
@giesse
giesse / profile-gab.red
Last active November 20, 2021 19:13
profile function for Red (two variants)
Red []
e.g.: :comment
; ideally not exported on the global context
delta-time*: function [code count] [
start: now/precise
loop count code
difference now/precise start
]
@toomasv
toomasv / multi-selection-text-list.red
Last active August 11, 2018 19:24
Multi-selection text-list
Red [
Author: "Toomas Vooglaid"
Date: 2018-08-10
Last: 2018-08-11
Purpose: {Attempt at multi-selection text-list style}
]
cnt: 0
view [
style multi-selection-text-list: text-list
on-create [face/extra: object [key: none selected: none selection: copy [] nums: copy [] layer: none]]