Skip to content

Instantly share code, notes, and snippets.

View gunharth's full-sized avatar

Gunharth Randolf gunharth

  • Innsbruck, Austria
View GitHub Profile
@gunharth
gunharth / recursion.js
Last active November 6, 2020 20:56
JS Recursion 1/2 Pyramid
//let stackCount = 0; // show stack sequence
let height = 4;
draw(height)
function draw(h) {
if (h === 0) {
return;
}
public String checkWinner() {
int index = 0;
for(int i = 0; i < 3; i++) {
if(!game[index].equals("") &&
game[index].equals(game[index+1]) &&
game[index].equals(game[index+2])) {
return game[index];
}
@gunharth
gunharth / calc.js
Created December 25, 2018 21:04 — forked from rockstar2046/calc.js
High-precision calculation for javascript,You can call add,sub,mul,div to calculate you variables.
/**
* @fileOverview Javascript high precision calculate
* @author ra <ra@rockagen.com>
* @version 0.1
* @see {@link http://usejsdoc.org|jsdoc}
* @example
*
* 0.05 + 0.01 //0.060000000000000005
* 1.0 - 0.42 //0.5800000000000001
* 4.015 * 100 //401.49999999999994
@gunharth
gunharth / gist:7ba879d65ec96f0895eefe8c834347f6
Created September 12, 2018 06:26
Collection of forge deployment scripts used for:
#jodel:
cd /home/forge/jodel.gunharth.io
git pull origin master
composer install --no-dev --optimize-autoloader
php artisan migrate
php artisan optimize
#php artisan route:clear
#php artisan route:cache
php artisan cache:clear
@gunharth
gunharth / gist:587ba671833634e91e0b77ead104ab6b
Created August 25, 2017 12:35
php 5.6: disable Warning HTTP_POST_DATA in php.ini
always_populate_raw_post_data = -1
@gunharth
gunharth / .my.cnf
Created August 25, 2017 12:21
MariaDB: Solve STRICT_TRANS_TABLES
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION
@gunharth
gunharth / .aliases
Last active February 15, 2017 13:44
My bash .aliases file
export PATH="$HOME/.composer/vendor/bin:$PATH"
# Git
alias ga="git add"
alias gaa="git add ."
alias gc="git commit -m"
alias gp="git push"
alias gs="git status"
alias gl="git log"
alias nah="git reset --hard && git clean -df"
@gunharth
gunharth / .env.travis
Created August 17, 2016 13:13 — forked from gilbitron/.env.travis
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@gunharth
gunharth / sublime-keymap
Last active November 11, 2016 22:11
sublime.keymap
[
{ "keys": ["f9"], "command": "expand_fqcn"},
{ "keys": ["shift+f9"], "command": "expand_fqcn", "args": {"leading_separator": true} },
{ "keys": ["f10"], "command": "find_use"},
{ "keys": ["f7"], "command": "insert_php_constructor_property" },
{ "keys": ["alt+c"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["alt+shift+c"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["alt+x"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
{ "keys": ["alt+,"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["alt+shift+,"], "command": "move_to", "args": {"to": "eof", "extend": false} },
@gunharth
gunharth / intro.markdown
Created May 26, 2016 20:25 — forked from tillsanders/intro.markdown
Laravel: drag-and-drop repositioning with auto-save of DB entries

Laravel: drag-and-drop repositioning with auto-save of DB entries

Use case: Database entries are represented in a table. By grabbing and moving a row up or down the table, you can change the entries' order/position. The changes are submitted automatically via ajax.

  • Uses jQueryUI (custom download: sortable is needed)
  • newly created elements are added to the top (see route /jobs/create)