Skip to content

Instantly share code, notes, and snippets.

View progsmile's full-sized avatar
🎓

Denys Klymenko progsmile

🎓
  • Kyiv, Ukraine
  • 16:41 (UTC +02:00)
View GitHub Profile
@gsouf
gsouf / AuthController.php
Last active April 9, 2021 00:25
oAuth with Phalcon and PHPoAuthLib
<?php
namespace Controllers;
use OAuth\Common\Service\AbstractService;
use OAuth\Common\Storage\Session as OAuthSession;
class AuthController extends ControllerBase {
// everytime we enter the controller, then we check for login, if yes, then we dont have to access here (except logout)
@boo1ean
boo1ean / constraints.sql
Last active May 16, 2019 08:39
Disable constraints in postgres
-- As superuser you can connect to the target database
\c best-database
-- Drop specific table triggers
alter table foo disable trigger all;
-- After you dirty work don't forget to reenable triggers
alter table foo enable trigger all;
@rlbaker
rlbaker / math_ops.exs
Last active June 3, 2017 08:36
Floor/Ceil
defmodule MathOps do
def floor(x) when x < 0 do
t = trunc x
case x-t == 0 do
true -> t
false -> t - 1
end
end
def floor(x) do
@CMCDragonkai
CMCDragonkai / higher_kinded_types_in_rust_and_haskell.md
Last active September 8, 2024 17:06
Rust/Haskell: Higher-Kinded Types (HKT)

Rust/Haskell: Higher-Kinded Types (HKT)

A higher kinded type is a concept that reifies a type constructor as an actual type.

A type constructor can be thought of in these analogies:

  • like a function in the type universe
  • as a type with a "hole" in it
@anatooly
anatooly / keymap.cson
Last active September 24, 2018 21:31
Atom.io keybindings/shortcuts like JetBrains (PhpStorm/WebStorm)
'.platform-win32, .platform-linux':
'alt-f1': 'tree-view:reveal-active-file'
'.platform-linux, .platform-linux .command-palette atom-text-editor':
'ctrl-shift-a': 'command-palette:toggle'
'.platform-linux':
'ctrl-shift-n': 'fuzzy-finder:toggle-file-finder'
'.platform-linux atom-text-editor':
@JeffreyWay
JeffreyWay / .bash_profile
Created July 31, 2015 19:20
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@rponte
rponte / get-latest-tag-on-git.sh
Last active October 17, 2024 20:03
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@hollodotme
hollodotme / Install-php7.md
Last active August 11, 2022 06:23
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@maxvt
maxvt / infra-secret-management-overview.md
Last active November 1, 2024 21:34
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

@mgwidmann
mgwidmann / twitter_stream.ex
Last active May 28, 2024 08:28
Infinite Streams with Elixir
# Elixir has lazily evaluated enumerable objects that allow you
# to work with enumerable objects like lists either only as needed
# or infinitely.
# Start up iex to play around
$ iex
# Typical enumeration is done eagerly where the result is computed ASAP
iex> Enum.map(1..10, fn i -> i * 2 end)
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]