Skip to content

Instantly share code, notes, and snippets.

View divyang4481's full-sized avatar

Divyang Panchasara divyang4481

View GitHub Profile
@ashmind
ashmind / MonoidsInCSharp.cs
Created March 11, 2011 23:15
Monoids in C# as I see them
public class Monoid<T> {
public T None { get; private set; }
public Func<T, T, T> Operation { get; private set; }
public Monoid(Func<T,T,T> operation, T none) {
this.Operation = operation;
this.None = none;
}
}
@eralston
eralston / DateFormat.js
Created May 12, 2011 15:52
Date Format 1.2.3 by Steven Levithan <stevenlevithan.com> - A date formatting library for JavaScript
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
@dgrunwald
dgrunwald / async.cs
Created March 2, 2012 20:33
Async/Await support for .NET 4.0
// Copyright (c) 2012 Daniel Grunwald
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
@jdewind
jdewind / gist:2467675
Created April 23, 2012 00:12
iOS mirroring selection
// Make sure MediaPlayer.framework has been added and the MPAudioVideoRoutingPopoverController interface has been declared.
@interface MyViewController ()
@property (strong, nonatomic) MPAudioVideoRoutingPopoverController *airplayPopoverController;
@end
- (void)someButtonTapped:(id)sender {
self.airplayPopoverController = [[MPAudioVideoRoutingPopoverController alloc] initWithType:0 includeMirroring:YES];
self.airplayPopoverController.delegate = self;
[self.airplayPopoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
@garchibald
garchibald / ODataExampleAutoMapperController
Created September 2, 2012 22:35
OData AutoMapper Integration
// Grant Archibald (c) 2012
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System;
@codef0rmer
codef0rmer / angular-jqueryui-dnd.html
Last active February 22, 2018 10:23
AngularJS + jQueryUI Drag & Drop
<!DOCTYPE html>
<html ng-app="App">
<head>
<meta name="description" content="AngularJS + jQuery UI Drag-n-Drop" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.1/angular.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.min.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<meta charset=utf-8 />
@Chrisedmo
Chrisedmo / dabblet.css
Created February 18, 2013 12:02
Overflow scroll horizontal - No FlexBox
@faruktoptas
faruktoptas / jcompile.sh
Created August 22, 2013 19:25
Sublime Text 2 Java compile build settings. Place jcompile.sh in /usr/bin directory then make it executable.
#!/bin/bash
file=$1
basename="${file%%.*}"
javac $file
java $basename
@faruktoptas
faruktoptas / objkeys.js
Last active January 4, 2019 10:19
JS Object Keys
function objkeys(obj){
keys = Object.keys(obj);
var ret = "";
for (var o in keys){
ret = ret +keys[o] + "=>" + obj[keys[o]] + "\n";
}
return ret;
}
@pda
pda / docker-mysql-initialize.sh
Created March 21, 2014 22:09
Docker script to initialize MySQL database; auth from remote hosts.
#!/bin/bash
# Initialize MySQL database.
# ADD this file into the container via Dockerfile.
# Assuming you specify a VOLUME ["/var/lib/mysql"] or `-v /var/lib/mysql` on the `docker run` command…
# Once built, do e.g. `docker run your_image /path/to/docker-mysql-initialize.sh`
# Again, make sure MySQL is persisting data outside the container for this to have any effect.
set -e
set -x