Skip to content

Instantly share code, notes, and snippets.

🎓
Studying

Alex Solomaha CyanoFresh

🎓
Studying
Block or report user

Report or block CyanoFresh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tom--
tom-- / Random bytes, ints, UUIDs in PHP.md
Last active Aug 22, 2019
PHP random bytes, integers and UUIDs
View Random bytes, ints, UUIDs in PHP.md

Random bytes, ints, UUIDs in PHP

Simple and safe random getters to copy-paste

string randomBytes( int $length )

int randomInt ( int $min , int $max )

string randomUuid ( void )
@jtrefry
jtrefry / Win10-64bit-npm.md
Last active Dec 6, 2019
Configuring Windows 10 (64-bit) for npm and node-gyp
View Win10-64bit-npm.md
  • Install Git for Windows
  • Install Node
  • Install Python 2.7.3
  • Install Microsoft Visual Studio 2015 Community
  • Open the command prompt as Administrator, run the following commands, then close the command prompt (a new prompt is required before the new environment variables will be available)
    • npm install -g npm
      • (Upgrades to npm v3, which no longer nests dependencies indefinitely. No more "maximum path length exceeded" errors due to the 260 character path limit in Windows, or needing to delete node_modules with rimraf.)
    • setx PYTHON C:\Python27\python.exe /m
      • (May need to change path to your custom install directory.)
  • Open a new command prompt and run the following commands. If these install without errors, you have bypasse
@nikmartin
nikmartin / Secure Sessions Howto
Last active Nov 11, 2019
Secure sessions with Node.js, Connect, and Nginx as an SSL Proxy
View Secure Sessions Howto
Secure sessions are easy, but it's not very well documented, so I'm changing that.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT]
To do this, here's what you need to do:
@paulkaplan
paulkaplan / colorTempToRGB.js
Last active Dec 1, 2019
Color Temperature to RGB
View colorTempToRGB.js
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work,
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)
function colorTemperatureToRGB(kelvin){
var temp = kelvin / 100;
@martinsik
martinsik / chat-frontend.js
Last active Dec 10, 2019
Node.js chat frontend and server
View chat-frontend.js
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
You can’t perform that action at this time.