Skip to content

Instantly share code, notes, and snippets.

View y-a-v-a's full-sized avatar
🕳️

Vincent Bruijn y-a-v-a

🕳️
View GitHub Profile
@y-a-v-a
y-a-v-a / checkCssHas.js
Created September 9, 2022 12:11
Simple feature detection for CSS :has()
(function() {
const s = document.createElement('style');
s.textContent = `.supportsHas:has(p):after {content: "hasHas";}`;
document.head.appendChild(s);
const supportsHas = document.createElement('div');
supportsHas.classList.add('supportsHas');
const p = document.createElement('p');
supportsHas.appendChild(p);
document.body.appendChild(supportsHas);
@y-a-v-a
y-a-v-a / server.js
Last active November 11, 2020 14:58
Nodejs php web server
//Lets require/import the HTTP module
var http = require('http');
var fs = require('fs');
var PORT=8080;
var spawn = require('child_process').spawn;
//We need a function which handles requests and send response
function handleRequest(request, response) {
@y-a-v-a
y-a-v-a / index.js
Last active April 17, 2016 11:56
Second lesson - basic twitter bot
// load a package that makes tweeting possible
var Twitter = require('twitter');
// configure the client so it can authorize itself
var client = new Twitter({
consumer_key: 'xyz',
consumer_secret: 'abc',
access_token_key: '012-xyz',
access_token_secret: 'ABC'
});
@y-a-v-a
y-a-v-a / php-jpeg-glitch.php
Last active April 17, 2016 11:56
First lesson - JPEG image manipulation with PHP
<?php
// loop 100 times
for ($j = 0; $j < 100; $j++) {
// open a file called some-file.jpg
// and store its data in a variable
$image = file_get_contents('./some-file.jpg');
// loop 10 times
for ($i = 0; $i < 10; $i++ ) {
@y-a-v-a
y-a-v-a / jpeg2mpg.sh
Created June 19, 2015 12:34
Create an mpg movie from a set of jpg images.
#!/bin/bash
# see http://www.ffmpeg.org/faq.html 3.2 and 3.3
#!/bin/bash
# Argument = -t test -r server -p password -v
usage()
{
cat << EOF
Usage: $0 options
@y-a-v-a
y-a-v-a / glitch.js
Created June 19, 2015 10:57
Simple glitch application that glitches images by manipulating the string data.
#!/usr/bin/env node
var gd = require('node-gd');
var fs = require('fs');
var c;
var img = fs.readFileSync('b.jpg', { encoding: 'binary' });
var imageBuffer = new Buffer(img, 'binary');
var newBuffer;
var ch = ['aasd','gwer'];