Skip to content

Instantly share code, notes, and snippets.

@zajca
zajca / stream-function.coffee
Created February 27, 2015 09:48
NODEJS - gridfs-stream - video
StreamGridFile = (req, res,size,id,contentType) ->
if req.headers['range']
parts = req.headers['range'].replace(/bytes=/, '').split('-')
partialStart = parts[0]
partialEnd = parts[1]
start = parseInt(partialStart, 10)
end = if partialEnd then parseInt(partialEnd, 10) else size - 1
chunkSize = end - start + 1
res.writeHead 206,
'Content-Range': 'bytes ' + start + '-' + end + '/' + size
@zajca
zajca / CSVImportCommand.php
Created October 31, 2014 07:58
Symfony2 custom command for import CSV
<?php
namespace PRIA\QuizApiBundle\Command;
use PRIA\Bundle\UserBundle\EntityRepository\RoundsRepository;
use PRIA\QuizApiBundle\Entity\Answers;
use PRIA\QuizApiBundle\Entity\Questions;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@zajca
zajca / install.md
Last active August 29, 2015 14:08
SET UP WINDOWS

OPEN CMD AS ADMIN

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

OPEN POWERSHELL as ADMIN

choco.exe install nodejs.install npm git.install python2 xampp.app VisualStudio2012WDX phpstorm