Skip to content

Instantly share code, notes, and snippets.

View steffentchr's full-sized avatar

Steffen Fagerström Christensen steffentchr

View GitHub Profile
@steffentchr
steffentchr / frontend-assignment-autocomplete.md
Created December 23, 2019 22:29
Frontend Assignment 3: Autocomplete input

Autocomplete input

full input

Implement the input above in React and CSS.

  1. Users should be able to search by typing into the search field. Search requests should be sent once every 300ms seconds while the user is typing.
  2. When a new character is entered old requests should be discarded.
  3. The search returns objects of two types: photos (videos) and live events.
  4. Search results should be displayed in a container below the input grouped by their type.
var fs = require('fs');
var Visualplatform = require('node-23video');
var FormData = require('form-data');
var uploadFileName = "/something/else.mp4";
var credentials = {
domain: "your.comain.com",
consumer_key: "89067856-abc...",
consumer_secret: "JtDohv...",
access_token: "12345-xyz...",
access_token_secret: "4dIZMs...",
@steffentchr
steffentchr / session-signing.js
Last active February 14, 2018 10:27
Session signing on TwentyThree with Node, request and oauth-1.0a
const request = require('request');
const crypto = require('crypto');
const OAuth = require('oauth-1.0a');
const domain = '<domain>';
const key = '<consumer_key>';
const secret = '<consumer_secret>';
const access_token = '<access_token>';
const access_secret = '<access_token_secret>';
const token = {
<?php
require_once('visualvideo.php');
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Content-Type: application/javascript");
function getSessionToken($returnUrl, $name, $email) {
// Fix: The client should be loaded as a global outside of the function
// Note: This required use of privileged credentials with the API
$client = new VisualVideo('http://mydomain.23video.com',
$consumerKey,
<?php
require_once('visualvideo.php');
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Content-Type: application/javascript");
function getProtectedToken($objectType, $objectId) {
// Fix: The result of this method should be cached and reused with memcached or similar
// Fix: The client should be loaded as a global outside of the function
$client = new VisualVideo('http://mydomain.23video.com',
$consumerKey,
@steffentchr
steffentchr / google-analytics.js
Created February 2, 2016 12:45
Google Analytics tracking module
/*
INTEGRATION: GOOGLE ANALYTICS
*/
Player.provide('integration-google-analytics',
{
googleAnalyticsAccount:'',
googleAnalyticsTrackPlayerPageview:0
},
function(Player,$,opts){
@steffentchr
steffentchr / UpgradeToIframe.as
Last active December 15, 2015 23:22
Flex ActionScript application that replaces the loaded Flash object with an iframe pointing to the same location with the same parameters.
package {
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.external.ExternalInterface;
import flash.utils.*;
[SWF(width="100%", height="100%")]
public class UpgradeToIframe extends Sprite {
private var interval:uint;
private function getIframeHtml():String {
@steffentchr
steffentchr / fullscreen-button.js
Last active October 9, 2015 22:04
Fullscreen mode for 23 Video players, done with `window.open()`
/*
MODULE: FULLSCREEN BUTTON
Handle full screen button and shortcut.
Fires:
- player:fullscreenchange
Answers properties:
- supportsFullscreen [get]
- fullscreen [get/set]
@steffentchr
steffentchr / keybase.md
Created October 6, 2015 08:04
keybase.md

Keybase proof

I hereby claim:

  • I am steffentchr on github.
  • I am steffentchr (https://keybase.io/steffentchr) on keybase.
  • I have a public key whose fingerprint is 3093 044C 5DE6 829D 6D7A 6BC8 648E 6DF9 AFDE AAD2

To claim this, I am signing this object:

@steffentchr
steffentchr / core.js
Created September 21, 2015 10:25
Player: Add a class to <body> for the current channel
Player.bind('player:video:loaded', function(e,video){
var body = $('body');
$.each(body.attr('class').split(' '), function(i,className){
if(/^album-\d+$/.test(className)) body.removeClass(className);
});
$.each(video.album_id.split(' '), function(i,id){
body.addClass('album-'+id);
});
});