Skip to content

Instantly share code, notes, and snippets.

View jasim's full-sized avatar

Jasim A Basheer jasim

View GitHub Profile
@jasim
jasim / test.ml
Last active September 18, 2016 10:20 — forked from gsg/test.ml
type instruction =
| Order of {id: int; price: float; size: int}
| Cancel of {id: int}
| Cancel_replace of {id: int; new_price: float; new_size: int}
let filter_by_oid instructions oid =
List.filter (function
o.id = oid
) instructions
var BetterBankingPage = React.createClass({
render: function() {
return (
<div className="BetterBankingPage">
<Header />
<AccountsList />
<Footer />
</div>
);
}
var ngAppElem = angular.element(document.querySelector('[ng-app]') || document);
window.injector = ngAppElem.injector();
window.inject = injector.invoke;
window.$rootScope = ngAppElem.scope();
Object.defineProperty(window, '$scope', {
get: function () {
var elem = angular.element(console._commandLineAPI.$0);
return elem.isolateScope() || elem.scope();
@jasim
jasim / bungee.prg
Created October 25, 2013 20:03
Sweet pulldown menu DSL in SuperLib, a CA-Clipper library from 1996. http://www.the-oasis.net/ftpmaster.php3?content=ftplib.htm
bungstart()
bungoption("Files")
bungdrop()
bungoption("Open" ,{} ,{||!lFileIsOpen} )
bungoption("Close",{||nil},{||lFileIsOpen } )
bungundrop()
bungoption("Edit")
bungdrop()
bungoption("DBF" ,{||nil},nil )
bungoption("Ascii",{||nil},nil )
class PhysicalStorageVolume
OS_VERSION = RbConfig::CONFIG['host_os']
def initialize(path)
@path = path
@path_exists = File.exists?(path)
end
def raise_error_if_file_doesnt_exist!
raise Errno::ENOENT.new(@path) unless @path_exists

manycopies init manycopies add volume /Volumes/My500GBPassport Rainmaker manycopies add volume /Volumes/OldSeagate80 Coconut manycopies add temporary volume / "MBP-Retina-temp"

manycopies ln "/Users/jasim/Pictures/Downloaded Albums/106517555286564995482" /Photos manycopies ln /Volumes/My500GBPassport/ManyCopies /

manycopies set sync /Photos /Documents Rainmaker manycopies set sync /Photos /Documents Coconut

@jasim
jasim / webrick genericserver demo.rb
Created May 14, 2013 17:41
Using WEBrick's GenericServer to talk over TCP without worrying about socket mechanics
# to test, run this file and `nc localhost 34242`, type a line and press enter
require 'webrick'
s = WEBrick::GenericServer.new(:Port => 34242)
trap("INT") { s.shutdown }
s.start do |sock|
begin
incoming=sock.readline
rescue EOFError => err
break
@jasim
jasim / method_missing_v1.rb
Created September 30, 2012 07:20
a simple example of method_missing and why you should use it with care
class Item
attr_reader :id
def initialize(id, properties)
@id = id
@properties = properties
end
def method_missing(m, *args, &block)
@properties[m]
@jasim
jasim / srshti_vim.md
Created March 29, 2012 10:50
Shortcuts for VimGet

#Basic Stuff#

##Movements##

  • Goto next word w
  • Goto previous word b
  • Select inner word viw
  • Select the inner block - vi{
  • Go to closing or opening tag - %
# Main sinatra app
require 'sinatra'
require 'activerecord'
require 'activesupport'
include ActionView::Helpers::DateHelper # add the required helpers here.
require 'controllers.rb'
# controllers.rb