Skip to content

Instantly share code, notes, and snippets.

View rajasharan's full-sized avatar

Raja Sharan Mamidala rajasharan

View GitHub Profile
@rajanaresh
rajanaresh / app.js
Last active September 17, 2015 21:16
SSL Certificate generation & websockets
var fs = require('fs');
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
var app = require('https').createServer(options);
var io = require('socket.io')(app);
@jb55
jb55 / .ctags
Created December 2, 2012 23:31
typescript ctags
--langdef=typescript
--langmap=typescript:.ts
--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\1/v,variables/
--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|private)[ \t]+([a-zA-Z0-9_]+)/\3/m,members/
--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/
@chalup
chalup / MultiUriCursorWrapper.java
Created August 13, 2014 18:57
CursorWrapper which a) allows setting multiple notification Uris on a Cursor and b) sets the "dirty" state after ContentResolver notification and dispatches change on ContentObserver registration
package com.futuresimple.base.provider;
import com.google.common.collect.Iterables;
import android.content.ContentResolver;
import android.database.ContentObservable;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.net.Uri;
#!/bin/sh
# Map LISTENing TCP ports to their PIDs using lsof
LSOF=/usr/sbin/lsof
# e.g. netstat -an
# 127.0.0.1.25 *.* 0 0 49152 0 LISTEN
# *.22 *.* 0 0 49152 0 LISTEN
// Created by STRd6
// MIT License
// jquery.paste_image_reader.js
(function($) {
var defaults;
$.event.fix = (function(originalFix) {
return function(event) {
event = originalFix.apply(this, arguments);
if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
event.clipboardData = event.originalEvent.clipboardData;
@cobalamin
cobalamin / HaskellVsElm.md
Last active April 2, 2022 09:19
Elm (0.17) syntax and functionality differences for Haskell programmers
  • Types are declared with : and not ::, and the consing operator conversely is :: instead of :
  • No where clauses, only let/in
  • The standard style is different, check http://elm-lang.org/docs/style-guide for reference
  • Multiline strings are a thing with """
  • Haskell's data corresponds to type in Elm, and also, Haskell's type corresponds to Elm's type alias
  • ($) is (<|), but you don't use it all that much – Elm people like the flipped operator (|>) which lets you build something that reads like a pipeline
  • Related: Backticks will likely die soon in favour of functions that have an argument order that lends itself to pipelining with (|>)
  • Also, (.) is (<<), and a flipped version (>>) exists, but I don't see it used that much either
  • (&gt;&gt;=) is not an available operator and would not be polymorphic (no typeclasses, see below), and is instead commonly named SomeType.andThen – e.g. Maybe.andThen : Maybe a -&gt; (a -&gt; Maybe b) -&gt; Maybe b
@alexfu
alexfu / DividerItemDecoration.java
Last active February 9, 2023 05:09
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@pdamoc
pdamoc / Mario.elm
Created May 8, 2016 20:00
Mario 0.17
import Html exposing (..)
import Keyboard
import Window exposing (Size)
import AnimationFrame
import Task
import Html.App as App
import Collage exposing (..)
import Element exposing (..)
@cb372
cb372 / jargon.md
Last active May 14, 2024 03:45
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

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: