Skip to content

Instantly share code, notes, and snippets.

@EtienneR
EtienneR / mycontroller.php
Created February 29, 2016 19:07
Twitter Bootstrap 4 pagination (http://v4-alpha.getbootstrap.com/components/pagination) with CodeIgniter 3
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul><!--pagination-->';
$config['num_tag_open'] = '<li class="page-item">';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="page-item active"><a class="page-link">';
$config['cur_tag_close'] = '</a></li>';
$config['next_tag_open'] = '<li class="page-item">';
$config['next_tag_close'] = '</li>';
$config['prev_tag_open'] = '<li class="page-item">';
$config['prev_tag_close'] = '</li>';
@EtienneR
EtienneR / current_folder.js
Created March 16, 2016 13:55
Get the current folder with NodeJS
const os = require('os');
if (os.platform() == 'win32') {
// Windows
var path_folder = __dirname.split("\\");
} else {
// Linux / MacOS
var path_folder = __dirname.split("/");
}
@EtienneR
EtienneR / recipe.go
Created March 14, 2016 23:38
Simple API JSON (go run recipe.go --> http://127.0.0.1:3000)
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type Recipe struct {
Title string `json:"title"`
@EtienneR
EtienneR / main.go
Created August 19, 2015 20:31
Display files in a folder and then, display file content
package main
import (
"fmt"
"io/ioutil"
"path/filepath"
)
type FileInfo struct {
Name string
@EtienneR
EtienneR / main.go
Created August 16, 2015 22:30
RSS bonus (Markdown)
package main
import (
"encoding/xml"
"github.com/russross/blackfriday"
"net/http"
"time"
)
func main() {
@EtienneR
EtienneR / main.go
Created August 16, 2015 22:29
RSS part5 ("pubDate")
package main
import (
"encoding/xml"
"net/http"
"time"
)
func main() {
http.HandleFunc("/", rssHandler)
@EtienneR
EtienneR / main.go
Last active August 29, 2015 14:27
RSS feed part4 (webserver)
package main
import (
"encoding/xml"
"net/http"
)
func main() {
http.HandleFunc("/", rssHandler)
http.ListenAndServe(":3000", nil)
@EtienneR
EtienneR / main.go
Created August 16, 2015 22:24
RSS feed part3
package main
import (
"encoding/xml"
"fmt"
"os"
)
func main() {
type Item struct {
@EtienneR
EtienneR / main.go
Created August 16, 2015 22:20
RSS feed part2
package main
import (
"encoding/xml"
"fmt"
"os"
)
func main() {
type Item struct {
@EtienneR
EtienneR / main.go
Last active August 29, 2015 14:27
RSS feed part1
package main
import (
"encoding/xml"
"fmt"
"os"
)
func main() {
type rss struct {