Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
prabirshrestha / Makefile
Last active March 9, 2020 02:06
generic c makefile
# Final binary
BIN = $(shell basename $$(pwd))
ifeq ($(OS),Windows_NT)
EXE+=.exe
endif
# Default to build with multiple instances for speed
MAKEFLAGS =+ -j
# VERSION = 0.1
" save all the completions
let s:completions = []
function! asyncomni#omnifunc(findstart, base)
if a:findstart
let l:line_string = getline('.')
let l:line = line('.')
let l:col = col('.')
" locate start of the word
let l:start = l:col -1
@prabirshrestha
prabirshrestha / HttpClient.java
Last active October 10, 2018 16:06
OkHttpClient+RxJava
package com.example.rx_okhttp;
import com.squareup.okhttp.OkHttpClient;
import org.apache.http.*;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicHttpResponse;
import rx.Observable;
import rx.Observer;
import rx.Scheduler;
@prabirshrestha
prabirshrestha / package.json
Created February 27, 2014 21:54
auto install bower after npm install
{
"name": "a",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "./node_modules/bower/bin/bower install"
},
"author": "",
@prabirshrestha
prabirshrestha / Bootstrapper.cs
Last active March 31, 2018 16:57
Server side reactjs rendering in Nancy with React.NET
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
{
base.RequestStartup(container, pipelines, context);
var react = new ReactEnvironment(
new JavaScriptEngineFactory(),
new ReactSiteConfiguration(),
new NullReactCache(),
@prabirshrestha
prabirshrestha / hide c# System.Object inherited methods.cs
Created November 26, 2010 17:09
Hide System.Object C# methods
#region Hide System.Object inherited methods
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
/// </returns>
/// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>
[EditorBrowsable(EditorBrowsableState.Never)]
@prabirshrestha
prabirshrestha / AndroidScheduler.java
Last active January 10, 2018 07:16
RxJava Android scheduler
package rx.concurrency;
import android.os.Handler;
import android.os.Looper;
import rx.Scheduler;
import rx.Subscription;
import rx.concurrency.ExecutorScheduler;
import rx.util.AtomicObservableSubscription;
import rx.util.functions.Func2;
@prabirshrestha
prabirshrestha / web.config
Created August 5, 2011 23:03
Staging Applications using url rewrite
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!-- Stage A:
A(enabled) B(enabled,negate)
Stage B:
A(enabled,negate) B(enabled)
@prabirshrestha
prabirshrestha / buck.rb
Last active November 3, 2017 11:08
Buck Homebrew recipe
# brew install --HEAD https://gist.github.com/prabirshrestha/5432041/raw/buck.rb
require 'formula'
class Buck < Formula
homepage 'http://facebook.github.io/buck/'
head 'https://github.com/facebook/buck.git'
def install
system "ant"
@prabirshrestha
prabirshrestha / log.log
Created August 9, 2017 19:14
performance - very slow compared to tsserver
This file has been truncated, but you can view the full file.
DEBUG --> { method: 'initialize',
jsonrpc: '2.0',
id: 1,
params:
{ rootUri: 'file:///D:/tmp/flow-helloworld',
capabilities: {},
rootPath: 'file:///D:/tmp/flow-helloworld' } }
DEBUG <-- { jsonrpc: '2.0',
method: '$/partialResult',
params: