This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Use case: | |
var map = parseFields('id,name,sub(name)'); | |
var dto = map(obj, map); | |
*/ | |
exports.parseFields = function(str) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class Program | |
{ | |
/// <summary> | |
/// The main entry point for the application. | |
/// </summary> | |
static void Main(string[] args) | |
{ | |
var service = new Service(); | |
var arguments = string.Concat(args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.directive('uiDynamicAttr', function($compile, $parse) { | |
return { | |
restrict: 'A', | |
terminal: true, | |
priority: 100000, | |
link: function(scope, element, args) { | |
var expression = element.attr('ui-dynamic-attr'); | |
if (expression) { | |
var attributes = $parse(element.attr('ui-dynamic-attr'))(scope); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(app, $) { | |
app.directive('fooBar', function($timeout) { | |
return { | |
link: function(scope, elm, attrs) { | |
elm.on('public.action', function(e) { | |
// do stuff, call it by $('#elm').trigger('public.action'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DependencyController : Controller | |
{ | |
public ActionResult Index(string repositoryName, string assembyName, string typeFullName) | |
{ | |
if (!String.IsNullOrWhiteSpace(assembyName) && | |
!String.IsNullOrWhiteSpace(typeFullName)) | |
{ | |
var assembly = Assembly.Load(assembyName); | |
if (assembly != null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"auto_complete": true, | |
"auto_complete_commit_on_tab": false, | |
"auto_complete_with_fields": true, | |
"bold_folder_labels": true, | |
"caret_style": "phase", | |
"detect_indentation": true, | |
"draw_white_space": "all", | |
"ensure_newline_at_eof_on_save": true, | |
"folder_exclude_patterns": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EnumerableExtensions | |
{ | |
public static IEnumerable<IEnumerable<TSource>> SplitWithRest<TSource>(this IEnumerable<TSource> source, params Func<TSource, bool>[] predicates) | |
{ | |
var taken = new List<TSource>(); | |
for (int i = 0, l = predicates.Length; i < l; i++) | |
{ | |
var take = source.Where(predicates[i]); | |
taken.AddRange(take); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste it in your browsers console while surfing on facebook and you will like all things | |
(function (){ | |
var d = [], | |
i = 0, | |
l = 0, | |
li = setInterval(function() { | |
if (i < l) { | |
console.log('like ' + i + ' out of ' + l); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!String.prototype.toUrl) { | |
String.prototype.toUrl = function(o) { | |
var r = this.replace(/\{([^{}]*)\}/g,function (a, b) { | |
var r = o[b]; | |
delete o[b]; | |
return typeof r === 'string' || typeof r === 'number' ? r : a; | |
} | |
), p = []; | |