Skip to content

Instantly share code, notes, and snippets.

View alessandroraffa's full-sized avatar
💻
Coding

Alessandro Raffa alessandroraffa

💻
Coding
View GitHub Profile
@alessandroraffa
alessandroraffa / bot.ts
Created January 29, 2023 15:11
A GPT-3 Discord chat bot in TypeScript with OpenAI
import {
Client,
Events,
GatewayIntentBits,
Message,
PartialMessage,
Partials,
} from "discord.js";
import { Configuration, OpenAIApi } from "openai";
@alessandroraffa
alessandroraffa / README.md
Created November 6, 2017 01:13 — forked from juliengdt/README.md
README.md template

NAME-OF-YOUR-PROJECT

This is a template README to show which informations it should contain.

You can talk about general purpose here in 2~3 lines to explain what it is.

Installation

Requirements

This is the requirement block; it explains which SW/HW you have to grab to run this project

@alessandroraffa
alessandroraffa / README.md
Created November 6, 2017 00:46 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@alessandroraffa
alessandroraffa / README-Template.md
Created November 6, 2017 00:43 — forked from PurpleBooth/README-Template.md
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

@alessandroraffa
alessandroraffa / bootstrap-masonry-plugin.js
Last active December 27, 2020 11:54
Responsive Bootstrap 3 Masonry
$(document).ready(function () {
var masonryOptions = {
columnWidth: '.masonry-sizer',
itemSelector: '.masonry-item',
percentPosition: true
};
var $masonryContainer = $('.masonry-container');
var masonryBreakpoint = 767; // change this as you wish
var masonryActive = false;
var activateMasonry = function () {
@alessandroraffa
alessandroraffa / web-app.html
Last active July 29, 2016 09:55
HTML5 <head> tags for web application
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>web app name</title>
<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-precomposed.png"><!-- Add to homescreen for Safari on iOS -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-precomposed-114x114.png"><!-- iPhone retina icon (iOS< 7) -->
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="/apple-touch-icon-precomposed-120x120.png"><!-- iPhone 6 Plus icon -->
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@alessandroraffa
alessandroraffa / isAssocArrayBench.php
Created July 28, 2016 15:09 — forked from Thinkscape/isAssocArrayBench.php
A benchmark of several methods for checking if PHP array is associative
<?php
if(!isset($argv[1])){
echo "Usage: ".$argv[0]." (number of iterations)\n";
exit(1);
}
/**
* Arrays to check
*/
$tests = array(
@alessandroraffa
alessandroraffa / DotNotation.php
Created July 26, 2016 15:34 — forked from antonmedv/DotNotation.php
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*