Skip to content

Instantly share code, notes, and snippets.

View ZkHaider's full-sized avatar

Haider ZkHaider

  • San Francisco, CA
View GitHub Profile
@leomelzer
leomelzer / Analyse.java
Created July 9, 2012 09:02
Simple-stupid Sentiment analysis for 1 million tweets.
package analyse;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@khanlou
khanlou / UIImageView+Network.h
Last active June 9, 2020 07:34
Quick and dirty UIImageView with networking
//
// UIImage+Network.h
// Fireside
//
// Created by Soroush Khanlou on 8/25/12.
//
//
#import <UIKit/UIKit.h>
@gabrielemariotti
gabrielemariotti / mobile-AndroidManifest.xml
Last active September 15, 2020 11:33
Android Wear: small gist to start an Activity on the mobile handheld from the Android Wear device.
<service android:name=".ListenerServiceFromWear">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
@slightfoot
slightfoot / CharacterCountErrorWatcher.java
Last active May 12, 2022 08:11
Material Design - Text field input - Over/under character or word count (android.support.design.widget.TextInputLayout) http://www.google.com/design/spec/patterns/errors.html#errors-user-input-errors
import android.graphics.Color;
import android.support.design.widget.TextInputLayout;
import android.text.Editable;
import android.text.Layout;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextWatcher;
import android.text.style.AlignmentSpan;
import android.text.style.ForegroundColorSpan;
@blackcj
blackcj / MainActivity.java
Last active July 24, 2024 01:40
Design support library with CoordinatorLayout, SwipeRefreshLayout and RecyclerView.
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.blackcj.designsupportexample.adapters.RecyclerViewAdapter;
@mwolfson
mwolfson / Logcat Filter Strings
Last active December 25, 2021 05:27
Logcat Filter String to silence the noise in the Logcat file
^(?!Wifi|HierarchicalStateMachine|MotoNetwCtrlr|HeadsetStateMachine|bt-btif|rmt_storage|ThermalEngine|TCMD|QC-time-services|ActivityModePolicy|AlarmManager|BatteryService|SQLiteLog|BackupManagerService|UpdateIcingCorporaServi|IccSmsInterfaceManager|HeadsetPhoneState|Launcher|LocationFilter|DeviceScanner|GCoreUrl|Icing|GCoreUlr|PackageBroadcastService|WindowManager|InputReader|SFPerfTracker|UsageStatsService|GmsNetworkLocationProvi|ConnectivityService|ConfigFetchService|TaskPersister|Finsky|SFPerfTracer|OpenGLRenderer|HotwordRecognitionRnr).*$
@daniel-hall
daniel-hall / SingleWriterPlayground.swift
Last active October 28, 2019 07:05
SingleWriter wraps any struct in a mechanism that only allows modifications through an optional-typed writer object. Only one writer object can exist at a time, so while one code site is referencing the writer or using it to change a property on the struct, any other code that attempts to get the writer to make changes will get a nil value.
// The SingleWriter generic type only works with structs
//
// SingleWriter wraps any struct in a mechanism that only allows modifications through an optional-typed writer object.
// Only one writer object can exist at a time, so while one code site is referencing the writer or using it to change
// a property on the struct, any other code that attempts to get the writer to make changes will get a nil value.
//
// This is a tool to work with global shared mutable state, that allows write access to be controlled across threads or
// call sites. Any code using the writer interface will cause any other code / threads to not have access to the writer
// interface.
//