Skip to content

Instantly share code, notes, and snippets.

View msurguy's full-sized avatar

Maksim Surguy msurguy

View GitHub Profile
@msurguy
msurguy / List.md
Last active September 8, 2023 04:07
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@msurguy
msurguy / DB.sql
Last active August 20, 2023 18:02
Dynamic dropdown in Laravel, let's say you have multiple drop downs (selects), you click on one and the contents of the other need to be dynamically changed. One solution is to dynamically load JSON from the API and change the dropdown dynamically depending on the user choice.
CREATE TABLE `makers` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
@msurguy
msurguy / PowerShellProfile.ps1
Created March 18, 2023 06:23
FFMPEG commands for stitching Blender videos
function stitch($inputPrefix, $outputFile, $crf = 18) {
if (-not $inputPrefix) {
Write-Error "Input prefix must be specified."
return
}
$cmd = "ffmpeg -r 30 -i ${inputPrefix}%04d.png -c:v libx264 -crf $crf -pix_fmt yuv420p -f mp4 $outputFile.mp4"
Invoke-Expression $cmd
}
#!/bin/sh
# ------------------------------------------------------------------------------
# Uses FFmpeg to create an H.264 encoded MPEG-4 movie at 30 fps from
# an image sequence; filesize/quality can be tuned with the second parameter.
#
# ------------------------------------------------------------------------------
# Usage:
# > sh makemovie.sh imageFolder 20
# - imageFolder is a folder containing the images
# - 20 is an optional constant rate factor value,
@msurguy
msurguy / readme.md
Last active June 4, 2022 16:28
installing psmoveapi on raspberry pi zero
git clone https://github.com/thp/psmoveapi.git --recursive
sudo apt-get update -y
cd psmoveapi/
mkdir build
cd build
cmake .. -DPSMOVE_BUILD_CSHARP_BINDINGS:BOOL=OFF -DPSMOVE_BUILD_EXAMPLES:BOOL=ON  -DPSMOVE_BUILD_JAVA_BINDINGS:BOOL=OFF -DPSMOVE_BUILD_OPENGL_EXAMPLES:BOOL=OFF -DPSMOVE_BUILD_PROCESSING_BINDINGS:BOOL=OFF -DPSMOVE_BUILD_TESTS:BOOL=OFF -DPSMOVE_BUILD_TRACKER:BOOL=OFF -DPSMOVE_USE_PSEYE:BOOL=OFF
make
sudo cp {psmove.py,_psmove.so} /usr/lib/python3.5
@msurguy
msurguy / rafParallax.js
Created April 15, 2015 18:26
parallax via requestAnimationFrame
var $content = $('header .content')
, $blur = $('header .overlay')
, wHeight = $(window).height();
$(window).on('resize', function(){
wHeight = $(window).height();
});
/**
* requestAnimationFrame Shim
@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@msurguy
msurguy / SVG Save.json
Created January 31, 2022 05:56
SVG Save
{
"export_version": "0.10",
"framed_nodes": {},
"groups": {},
"metainfo": {
"author": "",
"description": "",
"keywords": "",
"license": "CC-BY-SA"
},
@msurguy
msurguy / ESPSockets.ino
Created March 7, 2016 19:37
ESP8266 Websocket + FastLED
/*
When the sketch is uploaded, the ESP8266 will reboot and create its own access point called AutoConnect AP. Connecting to that AP will bring up the
list of available access points. Enter Username and PW for the access point and ESP module will save the credentials for you.
When the module is restarted, it will connect to the AP that you chose and should be available on the network. You can get its IP from the Serial monitor
or use mDNS library (it's uncommented by default, along with all usage of the library) to make the module discoverable.
To change colors on the module (Neopixels on Pin 2), simply go to the root URL of the web server.
@msurguy
msurguy / actions.yml
Created September 25, 2019 23:00
Github actions
// Slack action:
https://github.com/Ilshidur/action-slack
args = "tag v*"
tags:
- v1 # Push events to v1 tag
- v1.0 # Push events to v1.0 tag