Skip to content

Instantly share code, notes, and snippets.

# The MIT License
Copyright (c) 2020, Alessandro Segala
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:
@BaldDeveloper
BaldDeveloper / excel-interop.cs
Last active May 11, 2024 05:50
[excel-interop] #excel #worksheet
Microsoft.Office.Interop.Excel.Application objXL = null;
Microsoft.Office.Interop.Excel.Workbook objWB = null;
objXL = new Microsoft.Office.Interop.Excel.Application();
objWB = objXL.Workbooks.Open("Workbook Path and Filename");
Excel.Worksheet objSHT = (Excel.Worksheet)objWB.Sheets[1];
objSHT.Select(Type.Missing);
int rows = objSHT.Cells.Find("*", System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlPrevious, false, System.Reflection.Missing.Value, System.Reflection.Missing.Value).Row;
@fanfeilong
fanfeilong / the elemenet of programming.md
Last active May 11, 2024 05:49
《编程格调》读书笔记

备注:笔记类帖子只是在看书过程中的结构化树形缓存,以及少量评注,只做以后整理的素材之用。

  • 格调妙语
    • 无论哪种情况,要点在于使代码的意图不会被误解,而非炫技。
    • 分支和分支不要纠缠在一起,把关系检测表达式调个方向,程序就更容易理解了。
    • 分支与分支纠缠在一起,在任何语言中都会引发困扰。
    • 语言细节虽然各不相同,但编程格调的原理是一致的。
    • 问题在于,一个小问题也许不会造成大的破坏,但是多处引发困扰语句形成的积累效应,就会使程序十分费解了。
    • 好的程序应该返回错误信息或诊断信息。
  • 在计算机程序中非必要的跳转,已经被证明是错误的一大来源,并且通常这表明程序员没能很好地掌控代码走向。
@wojteklu
wojteklu / clean_code.md
Last active May 11, 2024 05:46
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@RobTrew
RobTrew / tidyJSCode.applescript
Last active May 11, 2024 05:46
Use js-beautify to reformat code in OS X 10.10 (Yosemite) Script Editor
// Ver 0.2
// Restores syntax highlighting by recompiling
// either restoring cursor or placing it at first error found
// Assumes installation of node.js
// http://nodejs.org/download/
// with npm at:
var pathNPM = '/usr/local/bin';
@RobTrew
RobTrew / wrapInSimpleTimingCode.js
Last active May 11, 2024 05:46
OS X 10.10 (Yosemite) Script Editor - Wrap selected line(s) in simple timing code (for performance experiments)
// ROBIN TREW 2015 MIT License
// OSX 10.10 SCRIPT EDITOR – WRAP SELECTED LINE(S) IN SIMPLE TIMING CODE (FOR PERFORMANCE EXPERIMENTS)
// Add remove '// ' from before printing characters
// Depends on a library .scpt being saved at ~/Library/Script Libraries/DraftsSE.scpt
// See: See: http://support.foldingtext.com/t/writing-scripts-which-run-on-both-foldingtext-and-ios-drafts-4/652/7
// INCLUDE LIBRARY OF IOS DRAFTS-COMPATIBLE EDITOR FUNCTIONS:
@RobTrew
RobTrew / outdentLines.js
Last active May 11, 2024 05:46
Outdent selected line(s) in OS X 10.10 Script Editor
// ROBIN TREW 2015 MIT License
// OSX 10.10 SCRIPT EDITOR – REDUCE INDENTATION OF SELECTED LINES (by Tab or 4 spaces)
// Add remove '// ' from before printing characters
// Depends on a library .scpt being saved at ~/Library/Script Libraries/DraftsSE.scpt
// See: See: http://support.foldingtext.com/t/writing-scripts-which-run-on-both-foldingtext-and-ios-drafts-4/652/7
// INCLUDE ALL OR PART OF LIBRARY OF IOS DRAFTS-COMPATIBLE EDITOR FUNCTIONS:
@RobTrew
RobTrew / indentLines.js
Last active May 11, 2024 05:46
Indent selected line(s) in OS X 10.10 Script Editor
// ROBIN TREW 2015 MIT License
// OSX 10.10 SCRIPT EDITOR – INDENT SELECTED LINES (with Tab or 4 spaces)
// Add remove '// ' from before printing characters
// Depends on a library .scpt being saved at ~/Library/Script Libraries/DraftsSE.scpt
// See: See: http://support.foldingtext.com/t/writing-scripts-which-run-on-both-foldingtext-and-ios-drafts-4/652/7
// INCLUDE ALL OR PART OF LIBRARY OF IOS DRAFTS-COMPATIBLE EDITOR FUNCTIONS:
@RobTrew
RobTrew / toggleComments.js
Last active May 11, 2024 05:46
Toggle selected comments in OS X 10.10 Script Editor
// ROBIN TREW 2015 MIT License
// OSX 10.10 SCRIPT EDITOR – TOGGLE COMMENTS
// Add remove '// ' from before printing characters
// Depends on a library .scpt being saved at ~/Library/Script Libraries/DraftsSE.scpt
// See: See: http://support.foldingtext.com/t/writing-scripts-which-run-on-both-foldingtext-and-ios-drafts-4/652/7
// INCLUDE LIBRARY OF IOS DRAFTS-COMPATIBLE EDITOR FUNCTIONS:
@Krzysiu
Krzysiu / extractAndGeotagFrames.bat
Created November 22, 2017 19:28
Extract frames from video every X seconds and geotag them using GPS data file. Requires exiftool and ffmpeg.
@echo off
rem Ksheesh Geotag Video Frames 0.0.1
rem
rem Extract frames from video every X seconds and geotag them using GPS data file.
rem Requires exiftool and ffmpeg.
rem Copyright (c) 2017 krzysiu.net
rem
rem Permission is hereby granted, free of charge, to any person obtaining a copy
rem of this software and associated documentation files (the "Software"), to deal