Skip to content

Instantly share code, notes, and snippets.

@jmas
jmas / Colorful-Language.markdown
Created September 13, 2019 06:47 — forked from mattnico/Colorful-Language.markdown
A Javascript function to calculate a unique color for any English word.

Colorful Language

This Javascript will calculate a unique color for any English word typed into it. Currently other alphabets are not supported. Punctuation and white space are ignored.

A Pen by Matt Nicolaysen on CodePen.

License.

@jmas
jmas / stem.md
Last active March 20, 2024 09:36
Stemming
@jmas
jmas / uniqid.js
Last active March 20, 2024 07:21
uniqid.js
/**
* If IDs are generated more than 1 millisecond apart, they are 100% unique.
* @url https://stackoverflow.com/a/44078785
* @returns String
*/
function uniqid() {
return Date.now().toString(36) + Math.random().toString(36).substring(2);
}
@jmas
jmas / index.html
Last active February 28, 2024 22:03
barcode javascript print
<svg id="code128"></svg>
<script src="https://cdn.jsdelivr.net/jsbarcode/3.3.16/barcodes/JsBarcode.code128.min.js"></script>
@jmas
jmas / i2c_address_scanner_arduino_esp8266.cpp
Created February 5, 2019 18:05
I2C address scanner Arduino (ESP8266) sketch
// --------------------------------------
// i2c_scanner
//
// Version 1
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
@jmas
jmas / cli.php
Created May 17, 2016 22:04
Slim Framework 3 as cli command
<?php
// php cli.php /update
require __DIR__ . '/vendor/autoload.php';
if (PHP_SAPI == 'cli') {
$argv = $GLOBALS['argv'];
array_shift($argv);
@jmas
jmas / Arduino 230v Light bulb dimming
Created May 22, 2016 21:50 — forked from ryanamaral/Arduino 230v Light bulb dimming
Arduino 230v Light Bulb Dimming (Portugal 220V 50 Hz)
//source: http://electronics.stackexchange.com/q/59615
int AC_LOAD = 3; // Output to Opto Triac pin
int dimming = 128; // Dimming level (0-128) 0 = ON, 128 = OFF
void setup()
{
pinMode(AC_LOAD, OUTPUT); // Set the AC Load as output
attachInterrupt(0, zero_crosss_int, RISING); // Choose the zero cross interrupt # from the table above
}
@jmas
jmas / meta-tags.md
Created January 25, 2022 11:05 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
import { ApolloServer, gql } from "apollo-server-micro";
import { makeExecutableSchema } from "graphql-tools";
import { User } from "../../utils/db";
const typeDefs = gql`
type User {
id: ID!
name: String!
email: String!
}