Skip to content

Instantly share code, notes, and snippets.

View AndyDaSilva52's full-sized avatar
🎯
Focusing

Anderson da Silva AndyDaSilva52

🎯
Focusing
View GitHub Profile
@dblock
dblock / getWeek.js
Created July 13, 2011 22:49
get week of the year in JavaScript
function( d ) {
// Create a copy of this date object
var target = new Date(d.valueOf());
// ISO week date weeks start on monday
// so correct the day number
var dayNr = (d.getDay() + 6) % 7;
// Set the target to the thursday of this week so the
@deanhume
deanhume / SeleniumMultipleBrowsers.cs
Created April 25, 2012 10:01
Selenium Multiple Browsers
namespace SeleniumTest
{
[TestFixture(typeof(FirefoxDriver))]
[TestFixture(typeof(InternetExplorerDriver))]
public class BlogTest<TWebDriver> where TWebDriver : IWebDriver, new()
{
private IWebDriver _driver;
[Test]
public void SearchResults_ShouldHaveCorrectPageTitle()
@rmetzler
rmetzler / gist:2947828
Created June 18, 2012 10:43
find all non UTF-8 encoded files
find . -type f | xargs -I {} bash -c "iconv -f utf-8 -t utf-16 {} &>/dev/null || echo {}" > utf8_fail
--Source Article/Blog
--http://decipherinfosys.wordpress.com/2009/06/22/mutating-tabletrigger-error-and-how-to-resolve-it/
Mutating table/trigger error and how to resolve it
Posted by decipherinfosys on June 22, 2009
Most of us who have worked in Oracle have encountered ORA-04091 (table xxx is mutating. Trigger/function might not see it) at some time or the other during the development process. In this blog post, we will cover why this error occurs and how we can resolve it using different methodology.
Mutating error normally occurs when we are performing some DML operations and we are trying to select the affected record from the same trigger. So basically we are trying to select records in the trigger from the table that owns the trigger. This creates inconsistency and Oracle throws a mutating error. Let us take a simple scenario in which we have to know total number of invalid objects after any object status is updated to ‘INVALID’. We will see it with an example. First let us create a table and then
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active May 21, 2024 10:21
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@cheynewallace
cheynewallace / ExportSchema.ps1
Last active March 21, 2024 07:08
Export MSSQL schema with PowerShell. This script will export your schema definitions for tables, stored procs, triggers, functions and views to .sql files
# Usage: powershell ExportSchema.ps1 "SERVERNAME" "DATABASE" "C:\<YourOutputPath>"
# Start Script
Set-ExecutionPolicy RemoteSigned
# Set-ExecutionPolicy -ExecutionPolicy:Unrestricted -Scope:LocalMachine
function GenerateDBScript([string]$serverName, [string]$dbname, [string]$scriptpath)
{
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
@anupdhml
anupdhml / lastfm_to_gmusic.py
Last active November 16, 2017 06:01 — forked from Timmmm/lastfm_to_gmusic.py
Lastfm loved tracks/playlist to Google Music playlist, either with songs from your library or from all access. Order of songs in lastfm is preserved and can export/load them from a json file.
#!/usr/bin/env python
# Lastfm loved tracks/playlist to Google Music playlist, either with songs from your library or from all access
# Order of songs in lastfm is preserved.
# First export the lastfm data in a json file, and then import it into Google Music
# You can edit the intermediate json file if you wish.
#
# Based on this script.
# https://gist.github.com/Timmmm/6572592
#
@matagus
matagus / APIs-webliography.md
Last active June 24, 2022 00:03
Links to posts, talks and slides talking about API design, arquitecture, testing, tools, etc
@jherax
jherax / filterArray.js
Last active May 6, 2024 09:35
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@rponte
rponte / split-string-by-token.sql
Last active March 3, 2022 14:13
Oracle PLSQL - splitting string by token using regexp_substr() function
--
-- splitting as columns
--
select regexp_substr('a-b-c', '[^-]+', 1, 1) as grupo_1
,regexp_substr('a-b-c', '[^-]+', 1, 2) as grupo_2
,regexp_substr('a-b-c', '[^-]+', 1, 3) as grupo_3
from dual;
-- result:
-- a b c