Skip to content

Instantly share code, notes, and snippets.

View gambitier's full-sized avatar
🏆
Open for collaboration

Akash Jadhav gambitier

🏆
Open for collaboration
View GitHub Profile
function getAllFiles(dirFullPath: string, arrayOfFiles: string[] = []) {
const files = readdirSync(dirFullPath);
arrayOfFiles = arrayOfFiles || [];
files.forEach(function (file) {
if (statSync(dirFullPath + '/' + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirFullPath + '/' + file, arrayOfFiles);
} else {
arrayOfFiles.push(path.join(dirFullPath, '/', file));
@gambitier
gambitier / deepGroupBy.js
Created January 6, 2023 06:11 — forked from leofavre/deepGroupBy.js
Similar to LoDash groupBy(), but with nested groups.
/**
* Part of [Canivete](http://canivete.leofavre.com/#deepgroupby)
*
* Groups the contents of an array by one or more iteratees.
* Unlike Lodash [`groupBy()`](https://lodash.com/docs/4.17.4#groupBy),
* this function can create nested groups, but cannot receive
* strings for iteratees.
*/
const deepGroupBy = (collection, ...iteratees) => {
let paths = collection.map(value => iteratees.map(iteratee => iteratee(value))),

Paste the code in your Browser’s Console

var jqry = document.createElement('script');
jqry.src = "https://code.jquery.com/jquery-3.3.1.min.js";
document.getElementsByTagName('head')[0].appendChild(jqry);
jQuery.noConflict();
@gambitier
gambitier / github_clone_using_token.sh
Created December 1, 2022 13:39 — forked from magickatt/github_clone_using_token.sh
Clone a GitHub repository using a Personal Access Token
export GITHUB_USER=magickatt
export GITHUB_TOKEN=secret
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
public class MyApplicationDataContext : DbContext
{
public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
OnBeforeSaving();
return base.SaveChanges(acceptAllChangesOnSuccess);
}
public override async Task<int> SaveChangesAsync(
bool acceptAllChangesOnSuccess,
internal static class ParseHelpers
{
public static T ParseXML<T>(string XMLString) where T : class
{
var reader = XmlReader.Create(XMLString.Trim().ToStream(), new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
return new XmlSerializer(typeof(T)).Deserialize(reader) as T;
}
private static Stream ToStream(this string @this)
@gambitier
gambitier / CubeJs-MongoDb.md
Last active October 5, 2022 07:25
CubeJs Integration with MongoDb

Use powershell to run following command

docker run -p 4000:4000 -p 3000:3000 -v ${PWD}:/cube/conf -e CUBEJS_DEV_MODE=true cubejs/cube

image

@gambitier
gambitier / regex.md
Created September 3, 2022 10:56 — forked from etiennemarais/regex.md
Regular expression for handlebars variables, includes, if/else blocks and unescaped variables

Regex

{{[{]?(.*?)[}]?}}

Captures the value of the variable name in a handlebars template

{{> components/templates/email/includes/email-tr-spacer }}
{{# deliveryAddress }}
@gambitier
gambitier / DumpRestoreMongodbCollection.md
Created August 28, 2022 17:45
dump & restore mongodb collection
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/jquery.tabletojson.min.js" integrity="sha256-H8xrCe0tZFi/C2CgxkmiGksqVaxhW0PFcUKZJZo1yNU=" crossorigin="anonymous"></script>
<script type="text/javascript">
// Basic Usage
var table = $('#mydata').tableToJSON();
// table == [{"First Name"=>"Jill", "Last Name"=>"Smith", "Score"=>"disqualified"},
// {"First Name"=>"Eve", "Last Name"=>"Jackson", "Score"=>"94"},
// {"First Name"=>"John", "Last Name"=>"Doe", "Score"=>"80"},
// {"First Name"=>"Adam", "Last Name"=>"Johnson", "Score"=>"67"}]