Skip to content

Instantly share code, notes, and snippets.

View kasperkamperman's full-sized avatar

Kasper Kamperman kasperkamperman

View GitHub Profile
@surma
surma / README.md
Last active March 8, 2024 12:06
webpack-emscripten-wasm

Minimal example making webpack and wasm/Emscripten work together.

Build instructions:

  • Clone this gist
  • npm install
  • npm start
  • Open http://localhost:8080
  • Look at console
@newhouse
newhouse / mediumUsersFollowedByCount.js
Last active January 6, 2024 00:43
Medium API: get number of followers for User
/**
* Example of how to get the number of followers for a Medium.com User.
*
*
* Related links:
* https://github.com/Medium/medium-api-docs/issues/30#issuecomment-227911763
* https://github.com/Medium/medium-api-docs/issues/73
*/
// LODASH
@Rican7
Rican7 / parse_windowszones.php
Last active November 22, 2018 09:42
Parsing Unicode CLDR Windows Timezones in PHP
<?php
// The location of the Unicode CLDR "windowsZones" mappings here
const XML_URL = 'http://unicode.org/cldr/data/common/supplemental/windowsZones.xml';
const XML_ZONE_MAP_XPATH = '/supplementalData/windowsZones/mapTimezones/mapZone';
const ZONE_TERRITORY_ATTRIBUTE = 'territory';
const ZONE_IANA_NAME_ATTRIBUTE = 'type';
const ZONE_WINDOWS_NAME_ATTRIBUTE = 'other';
@chirag-shinde
chirag-shinde / uploadMethodTwo.php
Last active April 21, 2021 07:39
PHP Script to Upload CSV to MongoDB. Method Two of Two.
<!-- MongoDB has a command named mongoimport which can be used to directly upload a CSV file into a particular collection of
a database with the first line of the csv as the keys and the following rest of the csv as the values for the respective keys
The format of mongoimport is as folllows
"mongoimport --db database_name --collection collection_name --file csv_file_name --type csv"
now we can use variables to store our database and collection's name.
we upload the file to get the filename and it's path and then simple substitute the database_name and collection_name etc
@adammhaile
adammhaile / FastLEDDisk.ino
Last active November 27, 2020 03:11
Examples of using angle and radius to select pixels on a circular pixel layout using FastLED
#include "FastLED.h"
#define NUM_LEDS 255
#define DATA_PIN SPI_DATA
#define CLOCK_PIN SPI_CLOCK
// Define the array of leds
CRGB leds[NUM_LEDS];
@fracasula
fracasula / getMp3StreamTitle.php
Last active April 24, 2024 00:38
How to get the MP3 metadata (StreamTitle) from a streaming URL
<?php
/**
* Please be aware. This gist requires at least PHP 5.4 to run correctly.
* Otherwise consider downgrading the $opts array code to the classic "array" syntax.
*/
function getMp3StreamTitle($streamingUrl, $interval, $offset = 0, $headers = true)
{
$needle = 'StreamTitle=';
$ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36';
@timpulver
timpulver / p5_keystroke_simulator.java
Created September 24, 2012 13:05
[Processing] Simulates a key press
import java.awt.AWTException;
import java.awt.Robot;
KeystrokeSimulator keySim;
void setup(){
keySim = new KeystrokeSimulator();
}
void draw(){
@plamere
plamere / FetchTrackAndAnalysisData.js
Created April 9, 2012 09:39
Syncing Echo Nest analysis to Spotify playback
function fetchSongInfo(track) {
info('Getting song info for ' + track.name + ' by ' + track.artists[0].name);
var url = 'http://developer.echonest.com/api/v4/track/profile?api_key=N6E4NIOVYMTHNDM8J&callback=?';
var track_id = fromSpotify(track.uri);
$.getJSON(url, { id: track_id, format:'jsonp', bucket : 'audio_summary'}, function(data) {
if (checkResponse(data)) {
info("");
showTrackInfo(data.response.track);
fetchAnalysis(data.response.track);
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/