Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
so...

JozinSbazin josinSbazin

:octocat:
so...
  • Sberbank
  • Moscow
View GitHub Profile
@josinSbazin
josinSbazin / Extension For Android
Last active Sep 27, 2018
Extension For Android
View 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
}
}
View KotlinFastForEach
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++
}
}
View MM
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) {
View 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;
View telegram setWebhook
https://api.telegram.org/bot{API_TOKEN}/setWebHook?url={CURRENT_WEB_APP_URL}
@josinSbazin
josinSbazin / presa.gs
Last active Jan 18, 2018
Presentation
View presa.gs
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 Jan 10, 2018
create_parametric_section_lira
View 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;
View 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 Dec 13, 2017
F# Revit Hello World
View Command2.fs
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
View HelloWorldCommand.vb
Imports Autodesk.Revit.Attributes
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.UI
Namespace Command
<Transaction(TransactionMode.Manual)>
<Regeneration(RegenerationOption.Manual)>
Public Class HelloWorldCommand
Implements IExternalCommand