Skip to content

Instantly share code, notes, and snippets.

var globals = {
thingWeNeedClasses: undefined
};
require(["/Scripts/ThingWeNeed.js",
function (thingWeNeedClasses) {
globals.thingweNeedClasses = thingWeNeedClasses;
});
function doStuff() {
@jaypeeZero
jaypeeZero / blah.cs
Last active December 19, 2015 00:09
public void UpdateObjectChangesIfChanged<TEntity>(TEntity entity) where TEntity : EntityObject
{
// Run Audit Log code
this.SavingChangesAction = new Action<ObjectContext>(AuditTableLogAction<T>);
//this.ObjectContext.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
this.ObjectContext.SaveChanges();
}
public void UpdateObjectChanges<TEntity>(TEntity entity) where TEntity : EntityObject
{
@jaypeeZero
jaypeeZero / bind.js
Created April 25, 2013 16:59
Stolen directly from Underscore.js
var CR = {
bind: function (func, context) {
var nativeBind = Function.prototype.bind,
slice = Array.prototype.slice,
args,
bound,
ctor = function () {};
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!hb.isFunction(func)) throw new TypeError;
window.cr = window.cr || {
func1: function () {
console.log("Test this");
}
}
<script type="text/javascript" src="http://example.com/jquery-1.7.2.js"></script>
<script type="text/javascript">
var $j = $.noConflict(true);
</script>
<!-- load jQuery 1.3.2 -->
<script type="text/javascript" src="http://example.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
var $j19 = $.noConflict(true);
</script>
@jaypeeZero
jaypeeZero / less.less
Created March 6, 2013 18:04
Add this to your .LESS file
.bigModal{
position:fixed;
top:50%;
left:50%;
z-index:1050;
width:940px;
margin:-250px 0 0 -280px;
margin-left:-470px;
background-color:#fff;
border:1px solid #999;
public partial class MyWebPage {
public void SomeMethod() {
var imaginaryValues = /* Some long string array of values */
Page.GetWebValueControls().ForEach(c => {
c._getOrSetControlValue(true, imaginaryValues[THE_CORRECT_INDEX]);
});
}
}
public static class Extensions {
public static IEnumerable<T> Descendants<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> DescendBy) {
foreach (T value in source) {
yield return value;
foreach (T child in DescendBy(value).Descendants<T>(DescendBy)) {
yield return child;
}
}
}
var Coin = Backbone.Model.extend({
defaults: {
value: 0,
image: ''
}
});
var Coins = Backbone.Collection.extend({
model: Coin,
function (options) {
options = options ? _.clone(options) : {};
if (options.parse === undefined) options.parse = true;
var collection = this;
var success = options.success;
options.success = function(resp, status, xhr) {
collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options);
if (success) success(collection, resp);
};
options.error = Backbone.wrapError(options.error, collection, options);