Skip to content

Instantly share code, notes, and snippets.

@ramons03
ramons03 / Update remote repo
Created October 21, 2023 23:52 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@ramons03
ramons03 / README.md
Created October 24, 2019 01:16 — forked from chlab/README.md
vue webpack boilerplate: how to add env-specific build targets

When using the vue-webpack-boilerplate, you will have only a production build by default (besides dev and test setups). My team often has at least another environment we call "staging" where the client can test new features before we move them to production. Oftentimes, these environments will have env-specific config values, like a different API URL.

With the changes outlined below, you can create a separate config per environment. This assumes you've created a Vue.js project with vue-webpack-boilerplate.

  1. Apply the changes to the corresponding files in your project as outlined below
  2. Now, when you run npm run build staging it will build your project with the config values specific to your staging environment. You can easily add any number of other environments and build them the same way. npm run build or npm run build production will still build your production environment.
@ramons03
ramons03 / simplejsexportcsv.js
Created August 1, 2019 10:18
Export to csv from javascript.
function downloadFile(fileName, urlData) {
console.log('downloadFile', fileName);
var aLink = document.createElement('a');
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click");
aLink.download = fileName;
aLink.href = urlData;
aLink.dispatchEvent(evt);
}
import * as cocoSsd from "@tensorflow-models/coco-ssd";
const image = document.getElementById("image")
cocoSsd.load()
.then(model => model.detect(image))
.then(predictions => console.log(predictions))
@ramons03
ramons03 / VisualStudio.gitignore
Created June 19, 2017 15:16
VisualStudio gitignore
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
@ramons03
ramons03 / linqlambda.cs
Created May 31, 2017 14:09
LINQ async options with lambda using whenall
var tasks = foos.Select(DoSomethingAsync).ToList();
await Task.WhenAll(tasks);
var results = await Task.WhenAll(tasks);
return await Task.WhenAll(tasks);
var tasks = foos.Select(foo => DoSomethingAsync(foo)).ToList();
@ramons03
ramons03 / uncheckall.js
Created March 7, 2017 12:19
Uncheck all checkbox in javascript console.
var allInputs = document.getElementsByTagName("input");
for (var i = 0, max = allInputs.length; i < max; i++){
if (allInputs[i].type === 'checkbox')
allInputs[i].checked = false;
}
@ramons03
ramons03 / massrename.bat
Created January 11, 2017 14:32
Mass rename files windows command prompt
REM dir / -B > fileList.txt
REM for /f "tokens=1,2,3" %i in (fileList.txt) DO ren "%i %j %k" %k
for /f "tokens=1,2,3" %i in ('dir / -B') DO ren "%i %j %k" %k
@ramons03
ramons03 / yearupdate.sql
Last active January 11, 2017 14:08
Change Year only to a date column in SQL.
--SQL Server
UPDATE table SET DateToModify = DATEADD(YEAR, -1, DateToModify)
where YEAR(DateToModify) = 2015
--MySQL
UPDATE table SET DateToModify = DATE_ADD(DateToModify, INTERVAL 1 YEAR)
where YEAR(DateToModify) = 2015
@ramons03
ramons03 / flashtitle.js
Last active January 11, 2017 12:57
Flashing HTML Title Script
(function () {
var original = document.title;
var timeout;
var defaultTimes = 5;
window.flashTitle = function (newMsg, howManyTimes) {
function step() {
document.title = (document.title == original) ? newMsg : original;