Skip to content

Instantly share code, notes, and snippets.

View nielk's full-sized avatar
🦊

Alexandre Oger nielk

🦊
View GitHub Profile
@nielk
nielk / app.js
Last active December 22, 2015 00:28
A simple horizontal content slider with 2 slides
$(document).ready(function() {
$('.slide-01').click(function() {
$(this).toggleClass('hide-section');
$(this).parent().find('.slide-02').toggleClass('show-section');
});
$('.slide-02').click(function() {
$(this).parent().find('.slide-01').toggleClass('hide-section');
$(this).toggleClass('show-section');
});
@nielk
nielk / gist:6379571
Created August 29, 2013 15:30
content protected with password on drupal
<?php
// Add this into PHP code
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
if (!isset($_SERVER['PHP_AUTH_USER'])
|| $username != "qwerty" || $password != "qwerty") {
header('WWW-Authenticate: Basic realm="Please Login"');
header('HTTP/1.0 401 Unauthorized');
print 'Sorry, incorrect password or username.';
@nielk
nielk / gist:6350399
Last active December 21, 2015 18:49
node.js basic server
var http = require('http');
var fs = require('fs');
http.createServer(function(request, response) {
response.writeHead(200,{
'Content-Type':'text/html'
});
fs.readFile('index.html',function(err,contents){
/* response.write(contents);
response.end(); */

Deploying a dist folder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by yeoman).

Step 2