Skip to content

Instantly share code, notes, and snippets.

@krotscheck
krotscheck / concat-iterator.ts
Last active February 28, 2019 10:52
Concatenate any kind of iterable or iterator in typescript
export type IterableOrIterator<T> = Iterable<T> | Iterator<T> | AsyncIterable<T> | AsyncIterator<T>;
/**
* Concatenate any kind of iterable.
*/
export async function* concatIterable<T>(...iterators: IterableOrIterator<T>[]) {
for (let i of iterators) {
if (isIterable(i)) {
i = i[Symbol.iterator]();
} else if (isAsyncIterable(i)) {
@krotscheck
krotscheck / gist:4341297
Created December 19, 2012 22:50
List of revisionts for childrecord applicaiton
+++ frameworks/datastore/models/child_attribute.js
+++ frameworks/datastore/models/children_attribute.js
+++ frameworks/datastore/models/record.js
+++ frameworks/datastore/models/record_attribute.js
+++ frameworks/datastore/system/child_array.js
+++ frameworks/datastore/system/many_array.js
+++ frameworks/datastore/system/nested_store.js
+++ frameworks/datastore/system/record_array.js
+++ frameworks/datastore/system/store.js
@krotscheck
krotscheck / package.json
Last active December 2, 2015 17:18 — forked from oroce/package.json
run eslint only on changed (*.js files) files using pre-commit
{
"scripts": {
"eslint": "LIST=`git diff-index --name-only HEAD~1 | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi"
},
"devDependencies": {
"eslint": "~0.5.1"
},
"pre-commit": [
"eslint"
]
@krotscheck
krotscheck / gist:3956300
Created October 26, 2012 00:25
Fix for templateCollectionViews
// This gets added at the end of the if(content) block in arrayContentDidChange
// On nested records we additionally have to do a pass to see whether the order
// now matches.
this._refreshNestedRecordOrder();
// This is a new method.
@krotscheck
krotscheck / gist:3874921
Created October 11, 2012 19:29
DCPorter Override...
/**
* This is the DCPorter Memory fix, currently hosted at
*
* https://github.com/sproutcore/sproutcore/pull/844
*/
SC.Binding.isDestroyed = NO;
SC.Binding.destroy = function() {
// If we're already destroyed, there's nothing to do.
@krotscheck
krotscheck / gist:1979559
Created March 5, 2012 17:16
Sproutcore Wishlist
A list of things that I want in the SproutCore framework.
- Full HTML5 elements for the templateView
- In-Template binding
- getUserStream support in the media library (DIBS!).
- SC.StateSupport mixin to offer basic state management.
@krotscheck
krotscheck / gist:1962400
Created March 2, 2012 23:36
A quick Sproutcore nested document (for use with CouchDB) example.
This assumes the following document structure:
{
email: "myemail@mydomain.com",
firstName: "MyFirstName",
lastName: "MyLastName",
address: {
addressLine1: "Address Line 1",
addressLine2: "Address Line 2",
city: "Seattle",
@krotscheck
krotscheck / gist:1928572
Created February 28, 2012 02:10
How to install sproutcore from source.
# Do this first
sudo gem install sproutcore
sudo gem install bundler
# Do this next
mkdir ~/workspace
cd ~/workspace
sc-gen project my_sproutcore_project
git clone git@github.com:sproutcore/abbot.git
cd my_sproutcore_project

Keybase proof

I hereby claim:

  • I am krotscheck on github.
  • I am krotscheck (https://keybase.io/krotscheck) on keybase.
  • I have a public key whose fingerprint is E740 C748 1041 0726 6742 28CA 20E6 18D8 78DE 38AB

To claim this, I am signing this object:

class VersionController(rest.RestController):
@secure(checks.guest)
@wsme_pecan.wsexpose(wmodels.MyNonDBVersionModel)
def get(self):
# Get version things.
return wmodels.MyNonDBVersionModel( foo=bar, omg=cat)