Skip to content

Instantly share code, notes, and snippets.

@FeniXb3
FeniXb3 / DisableConsoleResize.cs
Created August 31, 2020 21:44
C# code for disabling minimizing, maximizing and resizing of console Window. Works on Windows, didn't check other systems.
/*
Code based on:
https://stackoverflow.com/a/34199784/1816426
https://stackoverflow.com/a/38175919/1816426
*/
class Program
{
// Documentation: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-deletemenu
private const int MF_BYCOMMAND = 0x00000000;
@FeniXb3
FeniXb3 / progress.py
Created May 22, 2018 07:57 — forked from vladignatyev/progress.py
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#
@FeniXb3
FeniXb3 / TextureOffsetController.cs
Created September 7, 2015 20:51
Small component for Unity3d that is responsible for looping texture on the gameobject. The gameobject that has uses this component needs a renderer with material that has a texture you want to use.
using UnityEngine;
public class TextureOffsetController : MonoBehaviour
{
public float speed = 0.05f;
private float position = 0.0f;
void Update()
{
@FeniXb3
FeniXb3 / Shake.js
Last active March 8, 2019 15:49 — forked from cocoademon/Shake.js
Simple "Shake" working with Phaser 2.0.2, allowing to shake not only camera, but single sprites also.
/*
Simple "Shake" plugin
Created by cocoademon - https://gist.github.com/cocoademon/7276093
*/
/*global Phaser */
/*jslint bitwise: true */
Phaser.Plugin.Shake = function (game, parent) {
'use strict';
@FeniXb3
FeniXb3 / runallscripts.bat
Created March 6, 2014 17:42
Small Windows batch script to execute all SQL scripts in current directory. The database name is passed as a parameter.
for %%G in (*.sql) do sqlcmd /S [servername] /d %1 -U [SQL username] -P [password] -i"%%G"
pause
@FeniXb3
FeniXb3 / DateTimeExampleForm.cs
Last active August 29, 2015 13:56
Example of clearing displayed value of DateTimePicker in WInForms with C#. Solution found at StackOverflow - http://stackoverflow.com/a/13364582/1816426
using System;
using System.Windows.Forms;
namespace DateTimePickerExample
{
public partial class DateTimeExampleForm : Form
{
DateTimePickerFormat defaultDateTimePickerFormat = DateTimePickerFormat.Long;
public DateTimeExampleForm()
@FeniXb3
FeniXb3 / Disable and re-enable all constraints on database.sql
Last active December 26, 2015 08:29
Disable and re-enable all constraints on database in T-SQL. Reference - http://stackoverflow.com/a/161410/1816426
-- disable all constraints
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
-- enable all constraints - the print is optional
exec sp_msforeachtable @command1="print '?'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"