Skip to content

Instantly share code, notes, and snippets.

View osvik's full-sized avatar
💭
Working

Osvaldo osvik

💭
Working
View GitHub Profile
@osvik
osvik / page-to-test.html
Last active July 11, 2021 22:00
Example on how to run tests in the browser. Running tests in the browser has advantages in many use cases as you can test the page in different mobile and desktop browsers and interact with the DOM.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Example of simple javascript testing in the browser</title>
</head>

SVGjs CHEAT SHEET

More info...

Begining of the svg file

Adobe Illustrator will give you something like this, but you must add the width and height attributes based in the viewBox.

<?xml version="1.0" encoding="utf-8"?>
@pmkay
pmkay / top-brew-packages.txt
Last active May 4, 2024 13:12 — forked from r5v9/top-brew-packages.txt
Top homebrew packages
node: Platform built on V8 to build network applications
git: Distributed revision control system
wget: Internet file retriever
yarn: JavaScript package manager
python3: Interpreted, interactive, object-oriented programming language
coreutils: GNU File, Shell, and Text utilities
pkg-config: Manage compile and link flags for libraries
chromedriver: Tool for automated testing of webapps across many browsers
awscli: Official Amazon AWS command-line interface
automake: Tool for generating GNU Standards-compliant Makefiles
@osvik
osvik / AddBrowserLanguagesAsClasses.js
Last active April 23, 2017 08:30
Add browser languages as CSS classes
/*jshint browser: true*/
/**
* Adds the content of navigator.languages or navigator.language as classes to body
* This script must be added after the opening <body> tag.
* @author Osvaldo Gago
*/
(function () {
@jazzsequence
jazzsequence / add_unfiltered_html_to_editors.php
Last active March 19, 2024 01:25
Add `unfiltered_html` capability to editors on multisite.
<?php
/**
* Add `unfiltered_html` capability to editors (or other user roles).
* On WordPress multisite, `unfiltered_html` is blocked for everyone but super admins. This gives that cap back to editors
* and above.
*
* @author Justin Tadlock
* @link http://themehybrid.com/board/topics/add-unfiltered_html-capability-to-editor-role#post-4629
* @param array $caps An array of capabilities.
* @param string $cap The capability being requested.
@wojteklu
wojteklu / clean_code.md
Last active May 12, 2024 06:31
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

package main
import (
"database/sql"
"gopkg.in/gorp.v1"
"log"
"strconv"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"