Skip to content

Instantly share code, notes, and snippets.

@miparnisari
miparnisari / Gulpfile.js
Created October 4, 2016 13:02
Gulpfile
"use strict";
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var debug = require('gulp-debug');
var cache = require('gulp-cache');
○ Unicode:
§ Unicode comprises over one million characters divided in 17 different planes (contiguous groups of characters): BMP are mostly everyday characters, Astral, etc.
§ Astral characters include emojis but they aren't well supported because they are considered two characters, so regexes that use them may often work in unexpected ways.
§ Use the /u flag in ES6 to overcome this. Use it with caution.
○ El codigo es dato
§ Harvard architecutre: code + data in different places
§ Von Neuman architecture: code + data in the same place (it won)
○ Ethereum:
§ Ether is the cryptocurrency
§ Blockchain: records that store the transactions
using System;
using System.Collections;
using System.Xml.Linq;
using UnityEngine;
using UnityEngine.Networking;
public class TextToSpeech : MonoBehaviour {
public static readonly string accessUri = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken";
public static readonly string synthesizeUri = "https://speech.platform.bing.com/synthesize";
using NUnit.Framework;
using System.Collections;
using UnityEngine.TestTools;
public class NewEditModeTest {
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityTest]
public IEnumerator NewEditModeTestWithEnumeratorPasses() {
@miparnisari
miparnisari / Web Deploy.xml
Last active May 9, 2018 06:10
aspnetcore21-mparnisari - Web Deploy.pubxml
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ResourceId>/subscriptions/d1e23ab5-7c4a-4abe-8b3a-272ec2155cf8/resourcegroups/stackoverflow/providers/Microsoft.Web/sites/aspnetcore21-mparnisari</ResourceId>
<ResourceGroup>stackoverflow</ResourceGroup>
@miparnisari
miparnisari / tcx_fixer.py
Created May 23, 2021 06:33
Fix distances set to 0 in TCX using https://www.plotaroute.com
from xml.dom import minidom
import xml.etree.ElementTree as ET
import math
import decimal
# send the original TCX file to https://www.plotaroute.com/ and export it to get the right distances
fixed_doc = minidom.parse('fromplotaroute.tcx')
distances = []
for fixedElem in fixed_doc.getElementsByTagName('Trackpoint'):
# Have zsh return case-insensitive auto-complete matches, but prefer exact matches
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
autoload -Uz compinit && compinit
# git prompts with a branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
setopt PROMPT_SUBST
@miparnisari
miparnisari / launch.json
Created October 7, 2021 01:04
Config to debug a VS code extension
{
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Debug client.ts",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
function sendingRequest(msg, initiator, helper) {
var urlParams = msg.getUrlParams();
console.log("Url Params before update: " + urlParams);
var updatedUrlParams = modifyParams(urlParams);
console.log("Url Params after update: " + urlParams);
msg.setGetParams(updatedUrlParams);
}
function modifyParams(params) {
let iterator = params.iterator();
// in makefile
.PHONY: test-migration-postgres
test-migration-postgres:
{ \
URI=postgres://postgres:password@localhost:5432/postgres; \
ENGINE=postgres; \
TOTALTUPLES=15; \
docker rm -f $${ENGINE} && \
make start-$${ENGINE} && \
./openfga migrate --datastore-engine $${ENGINE} --datastore-uri $${URI} --version 3 && \