Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View josinSbazin's full-sized avatar
:octocat:
so...

JozinSbazin josinSbazin

:octocat:
so...
View GitHub Profile
#[include timelapse.cfg] # если еще не настроили таймлапсы то будет ошбку выдавать. на первое время можно закоментировать.
#[include macro.cfg] # если не копировали этот файл то тоже закоментить
# датчик филамента
[filament_switch_sensor filament_detection]
pause_on_runout: True
# When set to True, a PAUSE will execute immediately after a runout
# is detected. Note that if pause_on_runout is False and the
# runout_gcode is omitted then runout detection is disabled. Default
# is True.
@josinSbazin
josinSbazin / Extension For Android
Last active September 27, 2018 10:19
Extension For Android
inline fun <V: View> V.isVisibleAndActionOrGone(condition: Boolean, body: (V) -> Unit) {
if (condition) {
this.visibility = View.VISIBLE
body(this)
} else {
this.visibility = View.GONE
}
}
@josinSbazin
josinSbazin / KotlinFastForEach
Created August 17, 2018 19:03
Kotlin Fast For Each
inline fun <reified T> List<T>.foreach(crossinline action: (T)
-> Unit): Unit {
val size = size
var i = 0
while (i < size) {
action(get(i))
i++
}
}
class MessageManager @Inject constructor(private val context: Context) {
fun showMessage(@StringRes message: Int, duration: Duration = Duration.Short) {
Toast.makeText(context, message, toToastDuration(duration)).show()
}
fun showMessage(message: CharSequence, duration: Duration = Duration.Short) {
Toast.makeText(context, message, toToastDuration(duration)).show()
}
fun showMessageAtTop(@StringRes message: Int, duration: Duration = Duration.Short) {
@josinSbazin
josinSbazin / Stats
Created March 17, 2018 19:24
Stats
using System;
using System.Collections.Generic;
using Develop.DevScripts.Game.Effects;
using Develop.DevScripts.Game.Effects.Components;
using Develop.DevScripts.Managers;
using LeopotamGroup.Collections;
using NUnit.Framework.Constraints;
using UnityEngine;
using Modificator = Develop.DevScripts.Game.Effects.Components.StatsEffectComponent.Modificator;
@josinSbazin
josinSbazin / telegram setWebhook
Created January 18, 2018 11:35
telegram setWebhook
https://api.telegram.org/bot{API_TOKEN}/setWebHook?url={CURRENT_WEB_APP_URL}
@josinSbazin
josinSbazin / presa.gs
Last active January 18, 2018 11:12
Presentation
function doPost(e) {
var files = DriveApp.getFilesByName('GoogleScriptTeleg');
var file = files.next();
var spreadsheet = SpreadsheetApp.open(file);
var update = JSON.parse(e.postData.contents);
if ('message' in update) {
var msg = update.message;
var chatId = msg.chat.id;
@josinSbazin
josinSbazin / create_parametric_section_lira
Created January 10, 2018 15:17
create_parametric_section_lira
public int Create_beam_parametric_section(FamilySymbol _family_symbol)
{
if (_family_symbol == null)
return -1;
List<IPrimitive> primitiveList = new List<IPrimitive>();
List<Vertex3>[] A_0 = (List<Vertex3>[]) null;
GeometryElement geometry = ((Autodesk.Revit.DB.Element) _family_symbol).get_Geometry(new Options());
string str = ((Autodesk.Revit.DB.Element) _family_symbol).get_Parameter((BuiltInParameter) -1010105).AsString();
IEnumerator enumerator1 = (IEnumerator) geometry.GetEnumerator();
bool flag1 = false;
@josinSbazin
josinSbazin / HijackMethod
Created December 28, 2017 15:12
HijackMethod
public static void HijackMethod(MethodInfo source, MethodInfo target)
{
RuntimeHelpers.PrepareMethod(source.MethodHandle);
RuntimeHelpers.PrepareMethod(target.MethodHandle);
var sourceAddress = source.MethodHandle.GetFunctionPointer();
var targetAddress = (long)target.MethodHandle.GetFunctionPointer();
int offset = (int)(targetAddress - (long)sourceAddress - 4 - 1); // four bytes for relative address and one byte for opcode
@josinSbazin
josinSbazin / Command2.fs
Created December 13, 2017 13:00
F# Revit Hello World
namespace Command2
open Autodesk.Revit.UI
open Autodesk.Revit.Attributes
open System.Windows.Forms
[<Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)>]
type Command2() =
class
interface IExternalCommand with