Applied to jQuery 1.7 dev. This was just an idea i made long ago, dumping for keepsake.
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
/** | |
* Creates an object where each property is composed from | |
* an element of keys (key) and the value from callback(key). | |
* | |
* @param {array} keys The array of keys. | |
* @param {function} [callback=_.identity] The callback(key) that returns the object:s values. | |
* @return {object} Returns an object composed of the given keys and callback(key) for values. | |
*/ | |
_.objectMap = function(keys, callback) { | |
callback = callback || _.identity; |
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
#![feature(core)] | |
#![feature(std_misc)] | |
use std::thread::{Thread, JoinGuard}; | |
fn callback(v: usize) -> usize { v * 2 } | |
struct S { | |
cb: Box<Fn(usize) -> usize + Send>, | |
} |
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 std::thread::{self, JoinGuard}; | |
use std::option::Option; | |
use std::marker::Send; | |
fn callback(v: usize) -> usize { v * 2 } | |
type CB = Fn(usize) -> usize + Sync + Send; | |
type Callback = Box<CB>; | |
struct S<'a> { |
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
fn main() { | |
let b = B; | |
(&b as &A).a(); | |
} | |
trait A { | |
fn a( &self ); | |
} | |
struct B; |
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
// Dumping old code as gists... | |
(function($) { | |
$.mouseMovement = { | |
stack: [], | |
clearInterval: 1000 | |
}; | |
var stack = $.mouseMovement.stack; |
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
1. Download [terminal emulator] from playstore. | |
2. Open [terminal emulator] and execute the following: `am start --user 0 -n com.android.settings/.SecuritySettings`. This will launch the Security Settings which Philips has hidden. | |
3. Scroll down and: Enable unknown sources. | |
4. Profit. | |
<!-- references --> | |
[terminal emulator]: https://play.google.com/store/apps/details?id=jackpal.androidterm |
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
List.metaClass.foldn = { init, closure -> | |
def l = delegate.clone() | |
def acc = init | |
def it = l.listIterator() | |
while ( it.hasNext() ) { | |
def e = it.next() | |
it.remove() | |
closure( acc, e, it ) | |
} | |
return acc |
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
interface SearchResult<T> { | |
T getResult(); | |
double getRelevance(); | |
// Just for being able to "clone" with other relevance... | |
SearchResult<? extends T> withRelevance( double relevance ); | |
} | |
interface SearchCriteria<T> { | |
SearchResult<? extends T> apply( SearchResult<? extends T> result ); |
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
-------------------------------------------------------------------------------- | |
-- Copyright : (C) 2008 Edward Kmett, 2016 Mazdak Farrokhzad | |
-- License : BSD-style | |
-------------------------------------------------------------------------------- | |
{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances, | |
UndecidableInstances, MultiParamTypeClasses #-} | |
import Control.Applicative(Alternative) | |
import Control.Monad.Identity | |
import Control.Monad.State |
OlderNewer