Skip to content

Instantly share code, notes, and snippets.

View eyalcohen4's full-sized avatar

Eyal Cohen eyalcohen4

View GitHub Profile
@liranhason
liranhason / agent-capsule.md
Last active May 3, 2026 14:53
Agent Capsule - A pattern for building production AI agents as document folders powered by coding-agent as runtimes

Agent Capsule

A pattern for building production AI agents as documents, not agent code.

This document presents the core concept, offering a concise and accessible overview to guide implementation.

The Core Idea

Most production agents are built with an Agent SDK (OpenAI, LangChain, LangGraph, etc.). You write code for tool dispatch, memory, sub-agents, session state, and so on. Every new capability requires a code change and a deployment.

import UIKit
protocol Tweenable {
static func tweenedValue(begin: Self, end: Self, progress: Float) -> Self
}
extension Float: Tweenable {
typealias ValueType = Float
static func tweenedValue(begin: Float, end: Float, progress: Float) -> Float {
@kitze
kitze / store.js
Created January 24, 2018 13:14
simplified redux
import produce from 'immer';
import {createStore} from 'redux';
const handleActions = (actionsMap, defaultState) => (
state = defaultState,
{type, payload}
) =>
produce(state, draft => {
const action = actionsMap[type];
action && action(draft, payload);
@virolea
virolea / upload.js
Last active April 9, 2026 15:39
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@lenkavon
lenkavon / reactiveconf-2017-cfp-shared-logic-web-mobile.md
Last active November 21, 2017 10:00
Sharing code between web and mobile using React, ReactNative and Redux

This is the response to lightning talk CFP at ReactiveConf.

Sharing code between web and mobile using React + ReactNative + Redux

When you stand in front of the project that aims to come with mobile and web application, going for combo React.js & ReactNative is easy choice. But to decide how to handle the data flow is a different story.

My team made this decision and after couple of talks and earlier experience with graphQL + Relay, we went for Redux. Redux enabled us to share most of the bussines logic even though the apps differ in usecases. I would like to share the challenges we had to overcome with you.

@evturn
evturn / react-native-pin.js
Created August 26, 2017 06:01
Simple component for managing an arbitrary amount of digits as input for a pin.
import React, { Component } from 'react';
import { StyleSheet, TextInput, View } from 'react-native';
/*
*
* class SomeComponent extends Component {
* onValueChange = pin => {
* return someOperation(pin);
* }
*
@madcoda
madcoda / App.js
Created May 28, 2017 04:24
React-router v4 multi layout
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Link, Match, Redirect, Switch } from 'react-router-dom'
import OverviewPage from './page/OverviewPage'
import AccountPage from './page/AccountPage'
/*
Layouts, inline define here for demo purpose
you may want to define in another file instead
*/
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@freak4pc
freak4pc / IsraeliID.Validator.js
Last active June 17, 2024 16:19
Israeli ID Validator (Javascript)
function isValidIsraeliID(id) {
var id = String(id).trim();
if (id.length > 9 || id.length < 5 || isNaN(id)) return false;
// Pad string with zeros up to 9 digits
id = id.length < 9 ? ("00000000" + id).slice(-9) : id;
return Array
.from(id, Number)
.reduce((counter, digit, i) => {
import React, { Component, PropTypes } from 'react'
import {
Text,
View,
TouchableHighlight,
ScrollView,
StatusBar,
Dimensions,
Animated