Skip to content

Instantly share code, notes, and snippets.

Anuj anujb

Block or report user

Report or block anujb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anujb
anujb / GIF-Screencast-OSX.md
Created May 1, 2019 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

View CompileModelAsync.cs
async Task CompileModelAsync()
{
//Define remote URL
var model_remote_url = "";
var model_name = "FruitModel";
var model_file_extension = "mlodel";
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string model_path = Path.Combine(path, $"{model_name + model_file_extension}");
View gist:52c9bb9f09725a30f8c7
public class GzipWebClient : WebClient
{
protected override WebRequest GetWebRequest(Uri address)
{
var request = base.GetWebRequest(address);
if(request is HttpWebRequest)
{
((HttpWebRequest)request).AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
}
View gist:3eb0d162cdb244f63bec
Logger.Info("Sending analytics request to Segment.io ..", props);
var start = DateTime.Now;
HttpResponseMessage response = null;
try {
//breakpoint hit
response = _client.SendAsync(request).Result;
View gist:6788215
public class EventArgs<T> : EventArgs
{
public T Data { get; set; }
public EventArgs (T data)
{
Data = data;
}
public static EventArgs<T> From (T data)
@anujb
anujb / gist:5155283
Created Mar 13, 2013
ABAddressBook Check
View gist:5155283
if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0))
{
var status = ABAddressBook.GetAuthorizationStatus();
if (status == ABAuthorizationStatus.Denied || status == ABAuthorizationStatus.Restricted) {
// no address book
} else {
if (this.addressBook == null)
this.addressBook = new ABAddressBook();
if (status == ABAuthorizationStatus.NotDetermined) {
@anujb
anujb / gist:5154227
Created Mar 13, 2013
ABAddressBook Create
View gist:5154227
public static ABAddressBook Create (out NSError error)
{
IntPtr intPtr;
IntPtr value = ABAddressBook.ABAddressBookCreateWithOptions (IntPtr.Zero, out intPtr);
ABAddressBook result;
if (value == IntPtr.Zero)
{
error = new NSError (intPtr);
result = null;
}
@anujb
anujb / gist:5154221
Created Mar 13, 2013
ABAddressBook.Create
View gist:5154221
public static ABAddressBook Create (out NSError error)
{
IntPtr intPtr;
IntPtr value = ABAddressBook.ABAddressBookCreateWithOptions (IntPtr.Zero, out intPtr);
ABAddressBook result;
if (value == IntPtr.Zero)
{
error = new NSError (intPtr);
result = null;
}
@anujb
anujb / gist:4727142
Last active Dec 12, 2015
Task Threading and Memory Management
View gist:4727142
public class MyViewController : UIViewController {
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
for (int i = 0; i < Int32.MaxValue; i++) {
DoStuffAsync();
}
}
@anujb
anujb / gist:4528263
Created Jan 14, 2013
Gorilla json-rpc sample
View gist:4528263
package main
import (
"github.com/gorilla/rpc"
"github.com/gorilla/rpc/json"
"net/http"
)
type HelloArgs struct {
Who string
You can’t perform that action at this time.