Skip to content

Instantly share code, notes, and snippets.

View jaggedsoft's full-sized avatar
Productive

jagged jaggedsoft

Productive
View GitHub Profile
@coolaj86
coolaj86 / README.md
Last active September 6, 2021 20:20
Fastest uuid generator for node.js

Now published as @root/uuid

This is started out as a curiosity, pasted as a gist but now, years later, I've come back to it because there are too many of these uuid modules out there and they're too complicated.

This, however, is easy to read and understand (for me, at least). Even its tests are dependncy and build-step free.

node-uuid vs crazy-uuid vs fast-uuid

@hanksudo
hanksudo / stdev.js
Created July 18, 2013 10:02
Standard deviation(STDEV) with JavaScript
var stdev = function(arr) {
var n = arr.length;
var sum = 0;
arr.map(function(data) {
sum+=data;
});
var mean = sum / n;
@avibryant
avibryant / loess.js
Created August 17, 2011 15:45
Loess smoothing
//adapted from the LoessInterpolator in org.apache.commons.math
function loess_pairs(pairs, bandwidth)
{
var xval = pairs.map(function(pair){return pair[0]});
var yval = pairs.map(function(pair){return pair[1]});
console.log(xval);
console.log(yval);
var res = loess(xval, yval, bandwidth);
console.log(res);
return xval.map(function(x,i){return [x, res[i]]});
@smalot
smalot / PdfParser.php
Last active February 13, 2022 09:59
Use this static class to extract Text from Pdf files. It supports compressed and uncompressed Pdf (version 1.1 to 1.7) : tested It supports octal encoded (eg : \050) content, but not hexadecimal (eg : <005E>). In some cases, it works better than "pdftotext" binary tool.
<?php
/**
* @file
* Class PdfParser
*
* @author : Sebastien MALOT <sebastien@malot.fr>
* @date : 2013-08-08
*
* References :
@z0r0z
z0r0z / Multisig.sol
Last active March 9, 2022 01:50
Simple gas-optimized multi-signature contract.
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
/// @notice Simple gas-optimized multi-signature contract.
contract Multisig {
event Propose(address indexed proposer, uint256 indexed proposal);
event Sign(address indexed signer, uint256 indexed proposal);
event Execute(uint256 indexed proposal);
error NotSigner();
@sargonas
sargonas / cryptoPortfolio.gs
Last active April 5, 2022 13:27
crypto portfolio import for google sheets
/////////////////////////
//Section 1: Coin Value//
/////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//coin market value lookup (works for all coins, just pass a single coin symbol as a parameter)
function getCoinPriceBySymbol(symbol) {
var url = 'https://api.coinmarketcap.com/v1/ticker/';
var response = UrlFetchApp.fetch(url);
var json = JSON.parse(response.getContentText());
<!DOCTYPE html>
<html>
<head><title>ChamberedTest</title></head>
<script type="text/javascript" src="js/chambered.js"></script>
<style type="text/css">
canvas, img {
image-rendering: optimizeSpeed;
image-rendering: -moz-crisp-edges;
image-rendering: -webkit-optimize-contrast;
@alexstone
alexstone / slack_notification.php
Created March 3, 2014 06:54
Fire a Slack Notification via CURL
<?php
// (string) $message - message to be passed to Slack
// (string) $room - room in which to write the message, too
// (string) $icon - You can set up custom emoji icons to use with each message
public static function slack($message, $room = "engineering", $icon = ":longbox:") {
$room = ($room) ? $room : "engineering";
$data = "payload=" . json_encode(array(
"channel" => "#{$room}",
"text" => $message,
// Shortened version of this:
// http://www.bpfh.net/simes/computing/chroot-break.html
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
@desandro
desandro / halftone-cartesian.pde
Last active October 4, 2022 11:48
Half-ton halftones Processing sketch
// options
String imagePath = "img/desandro-avatar.jpg";
float res = 10; // resolution, dot density
float zoom = 3.0; // proportion to zoom image
boolean isAdditive = true; // true = RGB, false = CMY
float offsetAngle = 1; // affects dot pattern
/*
0 = no patter
0.05 = slight offset
1 = slight offset