Skip to content

Instantly share code, notes, and snippets.

View francoisromain's full-sized avatar

François Romain francoisromain

View GitHub Profile
<?php
$index = $_GET['data'];
//accessing database
$database = Array (
"SP500"=>2128.19,
"DOW"=>18150.44,
"NASDAQ"=>5194.41
function xyz_to_ρ (x, y, z) {
return Math.sqrt((x * x) + (y * y) + (z * z));
}
function zρ_to_θ (z, ρ) {
return Math.acos(z / ρ);
}
function yx_to_φ (y, x) {
return Math.atan(y / x);
@bastianallgeier
bastianallgeier / graphql.js
Created April 26, 2017 09:01
GraphQL micro client
// Client
const query = (query, data, headers) => {
return fetch('/api', {
method: 'POST',
headers: headers || {},
body: JSON.stringify({
query: query,
variables: data
})
}).then((response) => {
@artemgurzhii
artemgurzhii / EventEmitter.js
Last active February 26, 2019 15:21
Event Emitter
class EventEmitter {
constructor() {
this.events = {};
}
on(event, func) {
if(this.events[event]) {
this.events[event].push(func);
} else {
this.events[event] = [func];

Font "package manager"

I've been thinking about creating a font management service similar to traditional software package managers (e.g. Debian Aptitude, NPM, etc.)

The basic idea is this:

  1. There's a main repository of fonts that are free (as in free to distribute) that the working group hosts
  2. There's a small program that serves as the "manager", to be used or installed on client systems
  3. The "manager" can be configured to operate with multiple repositories
@adriaandens
adriaandens / xss-game.md
Created May 31, 2014 18:59
xss-game by Google

XSS-game by Google

Welcome, recruit! Cross-site scripting (XSS) bugs are one of the most common and dangerous types of vulnerabilities in Web applications. These nasty buggers can allow your enemies to steal or modify user data in your apps and you must learn to dispatch them, pronto!

At Google, we know very well how important these bugs are. In fact, Google is so serious about finding and fixing XSS issues that we are paying mercenaries up to $7,500 for dangerous XSS bugs discovered in our most sensitive products.

In this training program, you will learn to find and exploit XSS bugs. You'll use this knowledge to confuse and infuriate your adversaries by preventing such bugs from happening in your applications.

There will be cake at the end of the test.

@bastianallgeier
bastianallgeier / statify.php
Last active October 4, 2022 17:12
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@sixertoy
sixertoy / README.md
Last active April 23, 2023 22:35
ES6 Tips & Tricks

JavaScript Tips

Yarn/NPM

Reorder package.json

npx sort-package-json

Array

import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API