Skip to content

Instantly share code, notes, and snippets.

View amay077's full-sized avatar
🏠
Working from home

amay077 amay077

🏠
Working from home
View GitHub Profile
@jimmgarrido
jimmgarrido / AdjustResize.md
Last active December 12, 2019 05:36
AdjustResize Workaround for Xamarin.Forms

Forms 2.3.3+

Uses the new Platform Specifics feature

protected override void OnCreate(Bundle bundle)
{
	ToolbarResource = Resource.Layout.toolbar;
	TabLayoutResource = Resource.Layout.tabs;

	base.OnCreate(bundle);
@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active March 27, 2024 10:02
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@rudyryk
rudyryk / CustomTableViewRenderer.cs
Created August 3, 2015 13:17
C# — Custom Xamarin.Forms renderer for TableView to hide empty cells at the bottom
// NoEmptyRowsTableViewRenderer.cs
//
// No Rights Reserved
// http://creativecommons.org/publicdomain/zero/1.0/
//
// Assume you have `MyProject.MyTableView` sublass of
// `Xamarin.Forms.TableView` and want to hide extra
// empty rows at the bottom. All you need on iOS is to set
// `TableFooterView` to empty `UIView` in custom renderer.
//
// ネットに接続されてる間はtrueとか
var connected = new BooleanNotifier();
// ダウンロード中はtrueとか
var downloading = new BooleanNotfier();
var command = new[]
{
connected,
downloading.Select(x => !x)
}
@stoshiya
stoshiya / selenium chrome.md
Last active June 7, 2019 07:14
MacでSeleniumをつかってChromeを起動するまで

MacでSeleniumをつかってChromeを起動するまで

必要なもの

  • Mac OS X
  • Google Chrome
  • Homebrew
  • Node.js
  • selenium-server-standalone
  • chromedriver
@branneman
branneman / better-nodejs-require-paths.md
Last active April 8, 2024 00:22
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@koral--
koral-- / ImageCaptureHelper.java
Last active January 16, 2019 10:57
Helper for sending ACTION_IMAGE_CAPTURE intent and retrieve its results. Handles all low level operations
//MIT License
//Copyright (c) 2015 Karol Wrótniak, Droids On Roids
package pl.droidsonroids.imagehelpers;
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
@devlights
devlights / ZipFileSamples04.cs
Created June 5, 2013 02:57
System.IO.Compression.ZipFileクラスにて、日本語のディレクトリ名やファイル名を文字化けさせずに圧縮処理
namespace Sazare.Samples
{
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using Sazare.Common;
@mala
mala / gist:5107120
Last active March 19, 2020 01:41
TwitterのOAuthの問題の補足とか

https://gist.github.com/mala/5062931

の続き。

Twitterの人に色々と問題点は伝えたんだけど、これからOAuthのサーバー書く人や、クライアント書く人が似たような問題を起こさないようにするために、どうすればいいのかについて簡単に書きます。既存の実装真似して作るとうっかりひどい目にあう。

自分は意図的に「Twitterの脆弱性」という表現を使わないように気を使っていて、それはクライアントアプリ側の責任もあるからなのだけれども、安全に実装するための方法がわかりにくかったり誤解を招きやすかったり、Twitterに買収されているTweetDeckにも問題があったりしたので、それはやっぱりTwitter側の責任の比重が大きいとは思う。とはいっても別に責任を追求したかったり◯◯はクソだといったことを言いたいわけではなく、誰が悪いとか言う以前に、複合的な要因によって問題が起きるときには原因を正しく理解する必要があると思う。

そもそも何を担保に安全性を保証しているのか

  • サーバー側で秘密の鍵を持っている(それが無いとアクセストークンを取得できない or 使えない)
@mbostock
mbostock / .block
Last active July 20, 2017 07:30
Circle-Polygon Intersection
license: gpl-3.0