Skip to content

Instantly share code, notes, and snippets.

@rpavlik
rpavlik / fix_homebrew.rb
Created January 6, 2011 20:32 — forked from mxcl/install_homebrew.markdown
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@syshen
syshen / gist:4516930
Created January 12, 2013 09:31
core image crop and resize
CIFilter *resizeFilter = [CIFilter filterWithName:@"CILanczosScaleTransform"];
[resizeFilter setValue:ciImage forKey:@"inputImage"];
[resizeFilter setValue:[NSNumber numberWithFloat:1.0f] forKey:@"inputAspectRatio"];
[resizeFilter setValue:[NSNumber numberWithFloat:xRatio] forKey:@"inputScale"];
CIFilter *cropFilter = [CIFilter filterWithName:@"CICrop"];
CIVector *cropRect = [CIVector vectorWithX:rect.origin.x Y:rect.origin.y Z:rect.size.width W:rect.size.height];
[cropFilter setValue:resizeFilter.outputImage forKey:@"inputImage"];
[cropFilter setValue:cropRect forKey:@"inputRectangle"];
CIImage *croppedImage = cropFilter.outputImage;
@japboy
japboy / jade-ftw.md
Last active October 23, 2023 11:18
Jade について。

Jade FTW

こんにちは。今回は現実逃避を兼ねて Jade の素晴らしさをお伝えしたいと思います。

Jade とは何か

[Jade][0] は JST (JavaScript Templates) の一つであり、HTML を書くための[軽量マークアップ言語][1] である [Haml][2] に影響を受けた JavaScript テンプレートエンジンでもあります。

@shinyaohira
shinyaohira / App States and Multitasking.md
Last active October 5, 2023 07:57
アプリケーションの状態とマルチタスキング

全体的に簡略化し、必要と思われる部分を抜粋しました。

  • Not running

    アプリは起動されていないか、実行されていたけれどもシステムによって終了されています。

  • Inactive

@kristopherjohnson
kristopherjohnson / showForegroundNotification.java
Last active June 21, 2022 13:41
Shows a foreground notification for an Android service. Tapping the notification will display the app as if it was tapped in application launcher
private static final int NOTIFICATION_ID = 1;
private void showForegroundNotification(String contentText) {
// Create intent that will bring our app to the front, as if it was tapped in the app
// launcher
Intent showTaskIntent = new Intent(getApplicationContext(), MyMainActivity.class);
showTaskIntent.setAction(Intent.ACTION_MAIN);
showTaskIntent.addCategory(Intent.CATEGORY_LAUNCHER);
showTaskIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@shinyaohira
shinyaohira / View Controller Programming Guide for iOS.md
Last active July 19, 2023 13:23
iOS View Controllerプログラミングガイド

storyboard上で、initial view controllerから他のview controllerに対してrelationshipを確立します。同様に、それらのview controllerから他のview controllerにrelationshipを確立します。最終的に、storyboard上のほとんど、あるいは全てのview controllerを一つのグラフに接続します。接続されたview controllerが、iOSによっていつインスタンス化されるかは、relationshipのタイプによって決まります。

@cyrilmottier
cyrilmottier / AndroidManifest.xml
Last active January 30, 2023 00:04
Android example of how to add a custom logo to the ActionBar and ensure the best possible matching starting Window.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyrilmottier.android.anapp">
<!-- ... -->
<application
android:icon="@drawable/ic_launcher"
android:label="@string/config_app_name"
android:theme="@style/Theme.AnApp" >
@voluntas
voluntas / trello.rst
Last active August 20, 2020 14:55
Trello のススメ
@seamountain
seamountain / Migrating_to_WebView_in_Android_4.4.md
Last active January 18, 2022 06:26
Migrating to WebView in Android 4.4 翻訳

以下Android公式ドキュメント Migrating to WebView in Android 4.4 の翻訳です。 間違いなどあればぜひご指摘ください。拙いですが誰かの役に立てば幸いです。

Migrating to WebView in Android 4.4

Android 4.4(API レベル 19)では、Chrominium ベースの新しい WebView が紹介されました。この変更で、WebView のパフォーマンス向上し、最新の Web ブラウザに追いつくために、HTML5、CSS3やJavaScript を標準サポートします。WebView を使っているアプリは、Android 4.4 以上からはこれらのアップデートの恩恵を受けることになります。

本ドキュメントは WebVeiew の変更点について説明します。なお、その変更は Android 4.4 以上、つまり targetSdkVersion を "19" 以上にした場合です。

Note: targetSdkVersion を "18" 以下にした場合、WebView は以下で述べるような挙動をすることを避けるために、"quirks モード" になります。これは、パフォーマンス向上と Web 標準に対応するためです。