- node.js
- Installation paths: use one of these techniques to install node and npm without having to sudo.
- Node.js HOWTO: Install Node+NPM as user (not root) under Unix OSes
- Felix's Node.js Guide
- Creating a REST API using Node.js, Express, and MongoDB
- Node Cellar Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
- JavaScript Event Loop
- Node.js for PHP programmers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "totp", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"dependencies": { | |
"speakeasy": "^2.0.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TicTacToeGame | |
{ | |
/** @var int */ | |
private $width; | |
/** @var int */ | |
private $height; | |
/** @var int */ | |
private $winCond; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Application\ProdrepHelperBundle\Component\Event; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Security\Core\Exception\AuthenticationException; | |
use Symfony\Component\Security\Core\Exception\AccessDeniedException; | |
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | |
/** | |
*/ | |
class AjaxAuthenticationListener |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os.path | |
import re | |
from subprocess import call | |
DOCUMENTATION = ''' | |
module: php5mod | |
short_description: Wraps php5enmod/php5dismod functionality | |
description: |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.multiplayerpiano.com/ | |
var TEMP = 210; // bpm | |
function tap(note, part, next) { | |
MPP.piano.play(note, 1, MPP.client.getOwnParticipant(), 0); | |
setTimeout(function(){ | |
MPP.piano.stop(note, MPP.client.getOwnParticipant(), 0); | |
next(); | |
}, 60e3/(TEMP*part)*4); |
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle
The API we are creating in this gist will follow these rules :
- The API only returns JSON responses
- All API routes require authentication
- Authentication is handled via OAuth2 with
password
Grant Type only (no need for Authorization pages and such). - API versioning is managed via a subdomain (e.g.
v1.api.example.com
)
The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> | |
#include <iostream> | |
#include <signal.h> | |
#include <unistd.h> | |
class Strategy | |
{ | |
public: | |
virtual void use(void) = 0; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Toggle comment line | |
" Ctrl+/ | |
let s:comment_map = { | |
\ "c": '//', | |
\ "cpp": '//', | |
\ "go": '//', | |
\ "java": '//', | |
\ "javascript": '//', | |
\ "php": '//', |
NewerOlder