Skip to content

Instantly share code, notes, and snippets.

View pnmcosta's full-sized avatar
🥷
coding remotely

Pedro Maia Costa pnmcosta

🥷
coding remotely
View GitHub Profile
@karthiks
karthiks / BashScriptToSetupDemoRNProjectUsingExpo.sh
Created August 31, 2022 16:03
Bash script to setup Demo React Native project on Ubuntu OS
# Install Expo (for easy creation, bundling and maintenance of project for cross-platform)
npm i -g expo-cli
# Getting dirty with Expo
expo --help # to see commands list
expo register # to sign-up with the site
expo login
expo logout
expo login
expo whoami
@karthiks
karthiks / Windows11FirewallForWSL2ExpoDevServer.ps
Created August 31, 2022 15:57
Windows 11 Firewall setup for communication with Expo Dev Server in WSL2
# To get Env Variables available in Powershell
Get-ChildItem -Path Env:\
# To get host IP. See value for IPv4Address
Get-NetIPConfiguration
# Show Current Firewall Settings
netsh interface portproxy show v4tov4
# Reset/Clear All Firewall Settings
@eh-dub
eh-dub / index.d.ts
Last active June 10, 2021 16:45
Sapper + Svelte + Typescript
// in $PROJECT_ROOT/typings/@sapper
declare module '@sapper/app' {
// from sapper/runtime/src/app/types.ts
// sapper doesn't export its types yet
interface Redirect {
statusCode: number
location: string
}
// end
@pnmcosta
pnmcosta / vsts-fork-commands.sh
Last active July 4, 2022 05:31
Git commands to fork (and rebase) from GitHub to VSTS
# START Create Fork
# Author: Pedro Maia Costa <[email protected]>
# Note: Please see Gist first comment, replace <var-name> below with your values before running.
# fork branch into vsts
cd your-project
git init .
# the target <your-repo> as origin
git remote add origin https://<your-vsts>.visualstudio.com/<your-repo-url>
@dimitrispaxinos
dimitrispaxinos / SerilogHttpClientWrapper.cs
Last active October 31, 2024 18:43
HttpClient Wrapper with logging functionality using Serilog
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Serilog.Context;
namespace Serilog.RestCallMonitoring
{
public class SerilogHttpClientWrapper : HttpClient
{
private static string _templateString =
@felipensp
felipensp / bulk.cs
Created October 23, 2015 11:13
Oracle bulk insert for Dapper .NET
private static int OracleBulkExecuteImpl<T>(this IDbConnection cnn, ref CommandDefinition command)
{
object param = command.Parameters;
IEnumerable multiExec = GetMultiExec(param);
Identity identity;
CacheInfo info = null;
if (multiExec != null)
{
int total = 0;
bool wasClosed = cnn.State == ConnectionState.Closed;
@wingleung
wingleung / prepare-commit-msg.sh
Last active January 15, 2025 10:23
Automatically prepend JIRA issue key to commit message
#!/bin/sh
#
# Automatically adds Jira key to commit message
#
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
@anthonyholmes
anthonyholmes / bootstrap-sass-mixin-cheatsheet.scss
Created October 10, 2014 08:13
Bootstrap Sass Mixin Cheatsheet
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@danharper
danharper / background.js
Last active April 16, 2025 06:53
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@Daniel15
Daniel15 / 1_README.md
Last active March 22, 2025 04:24
Complete Google Drive File Picker example

Google Drive File Picker Example

This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.

Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.

See a demo at http://stuff.dan.cx/js/filepicker/google/