秘密鍵など誤ってコミットしてしまった場合に履歴を完全に削除する手順
参考:6.4 Git のさまざまなツール - 歴史の書き換え
$ git checkout -b clean-key-file
| // CalculatorView.swift | |
| // as seen in http://nshipster.com/ibinspectable-ibdesignable/ | |
| // | |
| // (c) 2015 Nate Cook, licensed under the MIT license | |
| import UIKit | |
| /// The alignment for drawing an String inside a bounding rectangle. | |
| enum NCStringAlignment { | |
| case LeftTop |
| public class MainActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| final RecyclerView recyclerView = new RecyclerView(this); | |
| setContentView(recyclerView); | |
| recyclerView.setHasFixedSize(true); |
| import android.os.Environment; | |
| import android.support.annotation.NonNull; | |
| import java.io.File; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.util.concurrent.TimeUnit; |
| using UnityEngine; | |
| using System.Collections; | |
| using UnityEngine.EventSystems; | |
| using UnityEngine.UI; | |
| #if UNITY_EDITOR | |
| using UnityEditor; | |
| #endif | |
| namespace UnityEngine.UI | |
| { |
秘密鍵など誤ってコミットしてしまった場合に履歴を完全に削除する手順
参考:6.4 Git のさまざまなツール - 歴史の書き換え
$ git checkout -b clean-key-file
node.js でパスを取得する方法についてのメモ
$ node ~/hoge/Foo.js/a.jsを実行したときに、
process.argv[1] から、node コマンドに指定された a.js のパス( ~/hoge/Foo.js/a.js )を取得できます| #!/bin/sh | |
| base=$1 | |
| convert "$base" -resize '29x29' -unsharp 1x4 "Icon-Small.png" | |
| convert "$base" -resize '40x40' -unsharp 1x4 "Icon-Small-40.png" | |
| convert "$base" -resize '50x50' -unsharp 1x4 "Icon-Small-50.png" | |
| convert "$base" -resize '57x57' -unsharp 1x4 "Icon.png" | |
| convert "$base" -resize '58x58' -unsharp 1x4 "Icon-Small@2x.png" | |
| convert "$base" -resize '60x60' -unsharp 1x4 "Icon-60.png" | |
| convert "$base" -resize '72x72' -unsharp 1x4 "Icon-72.png" | |
| convert "$base" -resize '76x76' -unsharp 1x4 "Icon-76.png" |
| # 私が考える安全なプログラムを書くために必要なこと | |
| 今も昔も「入力によって挙動が大幅に変わるAPI」が世の中には多数存在していて、プログラマが本来意図した挙動と異なる動作を引き起こしている。 | |
| - ファイルを開こうとしたらコマンドを実行できてしまったり | |
| - CSSセレクタを書いてるつもりがHTMLタグを生成してしまったり | |
| - SELECT文を発行するつもりがDELETE文を発行できてしまったり | |
| こういったときに | |
| - 入力値検証をしないと危険になる |
| buildscript { | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| classpath 'com.android.tools.build:gradle:0.5.+' | |
| } | |
| } | |
| apply plugin: 'android' | |
| tasks.withType(JavaCompile) { |
| import android.content.Context; | |
| import android.graphics.Paint; | |
| import android.util.AttributeSet; | |
| import android.util.TypedValue; | |
| import android.widget.TextView; | |
| /** | |
| * サイズ自動調整TextView | |
| * | |
| */ |