Skip to content

Instantly share code, notes, and snippets.

View MioGreen's full-sized avatar

Mio Green MioGreen

View GitHub Profile
@MioGreen
MioGreen / CityDataService.js
Created September 1, 2014 05:36
Всплывающий выбор городов.
function capitaliseFirstLetter(string)
{
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}
angular.module('pocketParty.services')
.service('CityDataService', function($q, $timeout) {
var cityData = [
'Москва'
@MioGreen
MioGreen / FacebookShareStrategy
Last active August 29, 2015 14:01
Facebook browser sharing
function FacebookShareStrategy(user, $http) {
var url,
userId = user.id,
userToken = user.token;
this.share = function (message, photos, htmlPresentation) {
url = 'https://graph.facebook.com/' + userId +
'/feed?callback=JSON_CALLBACK&message=' + message +
picture(photos) + presentation(htmlPresentation) +
'&access_token=' + userToken;
@MioGreen
MioGreen / Contract.Requires
Created November 14, 2011 09:39
Requires<T> pattern
public static class Contract
{
public static void Requires<T>(Func<bool> condition) where T : Exception, new()
{
if(!condition.Invoke())
{
throw new T();
}
}
}