Skip to content

Instantly share code, notes, and snippets.

@krotscheck
krotscheck / concat-iterator.ts
Last active Feb 28, 2019
Concatenate any kind of iterable or iterator in typescript
View concat-iterator.ts
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 / package.json
Last active Dec 2, 2015 — forked from oroce/package.json
run eslint only on changed (*.js files) files using pre-commit
View package.json
{
"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"
]
View keybase.md

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:

View gist:934e58dcf601ee5d0c80
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)
@krotscheck
krotscheck / gist:4341297
Created Dec 19, 2012
List of revisionts for childrecord applicaiton
View gist:4341297
+++ 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 / gist:3956300
Created Oct 26, 2012
Fix for templateCollectionViews
View gist:3956300
// 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 Oct 11, 2012
DCPorter Override...
View gist:3874921
/**
* 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 Mar 5, 2012
Sproutcore Wishlist
View gist:1979559
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 Mar 2, 2012
A quick Sproutcore nested document (for use with CouchDB) example.
View gist:1962400
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 Feb 28, 2012
How to install sproutcore from source.
View gist:1928572
# 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