Skip to content

Instantly share code, notes, and snippets.

View jimmy-collazos's full-sized avatar

Jimmy Collazos jimmy-collazos

View GitHub Profile
@6174
6174 / rust_linear_regression
Last active November 13, 2019 08:54
rust linear regression
// ==================================
// linear regression trainer in rust
// @author 6174
// ==================================
// use std::cell::RefCell;
use std::vec::Vec;
fn main() {
// linear_regression();
@PurpleBooth
PurpleBooth / README-Template.md
Last active August 19, 2025 12:57
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@telekosmos
telekosmos / uniq.js
Last active November 15, 2022 17:13
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@gaearon
gaearon / slim-redux.js
Last active August 7, 2025 09:46
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@darrenscerri
darrenscerri / Middleware.js
Last active July 11, 2023 02:59
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
var Middleware = function() {};
Middleware.prototype.use = function(fn) {
var self = this;
this.go = (function(stack) {
return function(next) {
stack.call(self, function() {
fn.call(self, next.bind(self));
});
@Shilo
Shilo / JavaSetTimeout.java
Last active April 21, 2021 23:42
Java "setTimeout" equivalent. (Credit: Oleg Mikhailov, http://stackoverflow.com/a/36842856)
// Asynchronous implementation with JDK 1.8:
public static void setTimeout(Runnable runnable, int delay){
new Thread(() -> {
try {
Thread.sleep(delay);
runnable.run();
}
catch (Exception e){
System.err.println(e);
}
@dtipson
dtipson / inlineFuncAsWorker.js
Last active June 5, 2017 09:41
Another simple implementation of pushing a potentially costly operation off to a worker thread
//main function for creating an inline worker:
//inlineWorker:: Function -> a -> Promise b
const inlineWorker = fn => msg => {
const scriptString = `const func = ${fn.toString()};
addEventListener('message', function(e) {
Promise.resolve(e.data)
.then(func)
.then(postMessage);
}, false);
`;
/**
* Copyright 2016 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@AlwaysBCoding
AlwaysBCoding / notes.txt
Last active January 30, 2025 06:37
Ethereum Ðapp Development - Video 3 | The Halting Problem And Why We Need Gas
// To learn more about the halting problem check out Gary Bernhardt's series on computation
https://www.destroyallsoftware.com/screencasts
// Ethereum Yellow Paper
http://gavwood.com/paper.pdf
// Ethereum OpCodes List
http://ethereum.stackexchange.com/questions/119/what-opcodes-are-available-for-the-ethereum-evm
// Ethereum OpCodes Gas Costs
@WaldoJeffers
WaldoJeffers / compose.js
Last active August 6, 2025 13:37
JavaScript one-line compose (ES6)
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)))
// Usage : compose functions right to left
// compose(minus8, add10, multiply10)(4) === 42
//
// The resulting function can accept as many arguments as the first function does
// compose(add2, multiply)(4, 10) === 42