Skip to content

Instantly share code, notes, and snippets.

@samacs
samacs / helper.php
Created October 16, 2012 05:58
Simple module to get articles in Joomla >1.6
<?php
abstract class modBreakingNews
{
public function getArticles(&$params)
{
$db =& JFactory::getDbo();
$application =& JFactory::getApplication();
$applicationParams = $application->getParams();
$model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
@samacs
samacs / docker-cleanup-resources.md
Created June 21, 2017 17:01 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

package main
import (
"fmt"
"os"
"strconv"
)
// Language: Go
//
version: "3"
services:
billine:
build:
context: .
dockerfile: billine/Dockerfile
hostname: billine
restart: always
env_file:
FROM ruby:2.6.3 AS builder
RUN apt-get update -qqy && \
apt-get install -qqy --no-install-recommends \
build-essential \
unzip \
xvfb \
cmake \
g++ \
qt5-default \
@samacs
samacs / posts.json
Created May 29, 2019 23:39
JSON Sample
// 20190529183835
// https://jsonplaceholder.typicode.com/posts
[
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
},
@samacs
samacs / units.json
Created May 28, 2019 19:04
Units (JSON)
{
"units": [
{
"id": "dc5f57a0-7c4a-4fb1-9958-c8ca4be5f257",
"price": 27.5,
"name": "108",
"description": "Air Cooled, Heated, Light in Unit, Stacked Space, 3rd floor",
"width": 5,
"length": 5,
"height": 8,
@samacs
samacs / main.go
Created May 21, 2019 00:39
Sort solution
package main
import "fmt"
// Language: Go
//
// Running:
//
// Assuming `elements := []int{1, 2, 3, 4}`
//
@samacs
samacs / main.go
Last active May 20, 2019 23:54
Shortest path in grid
package main
import (
"fmt"
"math"
)
// Language: Go
//
// Running:
@samacs
samacs / main.go
Last active May 20, 2019 22:56
Reverse Factorization
package main
import (
"bufio"
"fmt"
"io"
"os"
"sort"
"strconv"
"strings"