Skip to content

Instantly share code, notes, and snippets.

View terremoth's full-sized avatar
🌄
Open to work. #HireMe

Lucas M. Dutra terremoth

🌄
Open to work. #HireMe
  • Imaginum Softworks
  • Florianópolis, SC - Brazil
  • LinkedIn in/dutr4
View GitHub Profile
@jherax
jherax / is-private-mode.js
Last active March 19, 2024 18:29
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*
@vinicius73
vinicius73 / post.md
Created November 22, 2016 12:26
["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

#["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

Se preparem que o texto é longo.

Várias vezes chegam novatos aqui perguntando como começar, e a galera diz "estuda lógica primeiro, depois vai pra linguagem X". Vivo dizendo que é bobagem. Ontem, em particular, falei isso, e vieram várias pessoas por inbox me perguntar porquê (e uma pra me xingar, achando que falei por arrogância).

Pra facilitar, eu vou escrever uma boa explicação de porquê "lógica de programação" é furada, doa a quem doer, e postar na APDA e no fórum da EnergyLabs (para futuras referências, porque esse assunto vai voltar, ctz).

@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@vluzrmos
vluzrmos / paginate.php
Created July 20, 2016 14:31
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@simply-coded
simply-coded / SendGmail.vbs
Last active March 21, 2024 01:36
Send an email with vbscript using gmail.
'***********************
'Name: Email Messages
'Author: Jeremy England
'Company: SimplyCoded
'Version: rev.001
'Date: 1/02/2015
'***********************
Option Explicit
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objSHL : Set objSHL = CreateObject("WScript.Shell")
@logrusorgru
logrusorgru / mysql.sql
Last active January 16, 2024 07:01
SQL: uniqueness, automatic created_at, updated_at refresh + soft delete. SQLite, PostgreSQL, MySQL
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
-- mysql --
-- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- mysql <http://sqlfiddle.com/#!9/91afb5/2>
-- note: sqlfiddle is very stupid
@Avaq
Avaq / combinators.js
Last active March 18, 2024 20:49
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@ryasmi
ryasmi / mvc.coffee
Last active September 10, 2017 02:20
Example of "true" MVC
# Model contains "operations related to the application domain" [1].
class Model
route: document.location.href.split('#').slice(1).join('#')
listeners: []
getRoute: () -> @route
setRoute: (route) ->
@route = route
@change()
change: () -> @listeners.forEach(@runListener)
onChange: (listener) -> @listeners.push(listener)
@james2doyle
james2doyle / simple-json-reponse.php
Last active March 7, 2024 06:02
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($code = 200, $message = null)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");
@Ravenstine
Ravenstine / vbscript_wine.md
Last active August 18, 2023 19:43
Installing VBScript in Wine (Linux)

How to Run VBScripts in Wine

It's very easy but not straight-forward or documented anywhere.

First, install Wine 1.6.2. This version probably isn't required, but it's the version that currently ships with Debian Jessie and it works with VBScript.

Install Winetricks and use it to add the following libraries:

  • wsh57