Skip to content

Instantly share code, notes, and snippets.

View Blackcol's full-sized avatar

Andrés Alfonso Aguirre Girón Blackcol

View GitHub Profile
@0xdevalias
0xdevalias / react-server-components-next-js-streaming-wire-format.md
Last active March 4, 2025 07:39
Some notes on React Server Components (specifically the streaming wire format), Next.js v13+ (specifically `__next_f`), and Webpack

React Server Components, Next.js v13+, and Webpack: Notes on Streaming Wire Format (__next_f, etc)

Some notes on React Server Components (specifically the streaming wire format), Next.js v13+ (specifically __next_f), and Webpack.

Table of Contents

<p>To send command into some widget we use PostMessage (https://developer.mozilla.org/ru/docs/Web/API/Window/postMessage)<br>
Way to find required <iframe> is option "id" passed for initialization</p>
<p>Javascript and further HTML is Exapmle</p>
<p>NOTE: We use this tricky way because we need to handle all widgets the same. Both initialized with tv.js (https://www.tradingview.com/widget/advanced-chart/) and initialized self-replaced script (https://www.tradingview.com/widget/technical-analysis/)</p>
<!-- Example start -->
<!-- Advanced chart widget initialization -->
<div id="advanced-chart-widget-container"></div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
@imtaehyun
imtaehyun / technical-analysis-indicators-without-talib-code.py
Last active January 4, 2025 21:55
Technical analysis Indicators without Talib (code)
# https://www.quantopian.com/posts/technical-analysis-indicators-without-talib-code
import numpy
import pandas as pd
import math as m
#Moving Average
def MA(df, n):
MA = pd.Series(pd.rolling_mean(df['Close'], n), name = 'MA_' + str(n))
df = df.join(MA)
@james2doyle
james2doyle / simple-json-reponse.php
Last active March 7, 2024 06:02
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($code = 200, $message = null)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");
@hagino3000
hagino3000 / capture.js
Last active January 21, 2020 22:21
Capture screenshot using phantom.js
var page = new WebPage(),
address, output, size;
if (phantom.args.length != 2) {
console.log('Give me URL and filename');
phantom.exit();
} else {
address = phantom.args[0];
output = phantom.args[1];
page.viewportSize = { width: 1024, height: 768 };
@hagino3000
hagino3000 / client.js
Created December 8, 2011 18:42
WebSocket with binary data
var socket = null;
function bootstrap() {
// 適当な図形を描画
var c = document.getElementById('mycanvas');
var ctx = c.getContext('2d');
ctx.globalalpha = 0.3;
for(var i=0; i<1000; i++) {
ctx.beginPath();