This file contains hidden or 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
| import conversions from "webidl-conversions"; | |
| import reflector from "webidl-html-reflector"; | |
| var defineProperty = Object.defineProperty; | |
| export default class CustomHTMLMediaElement extends HTMLElement { | |
| get error() {} | |
| get src() { | |
| return reflector["DOMString"].get(this, "src"); | |
| } | |
| set src(v) { | |
| v = conversions["DOMString"](v); |
This file contains hidden or 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
| <?php | |
| function array_walk_recursive_key(array $array, callable $valueCallback, callable $keyCallback = null) { | |
| foreach ($array as $n => &$v) { | |
| $n2 = ($keyCallback) ? $keyCallback($n) : $n; | |
| if ($n != $n2) { | |
| $array[$n2] = &$array[$n]; | |
| unset($array[$n]); | |
| } | |
| if (is_array($v)) { |
This file contains hidden or 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
| /* | |
| Assuming jQuery Ajax instead of vanilla XHR | |
| */ | |
| //Get Github Authorization Token with proper scope, print to console | |
| $.ajax({ | |
| url: 'https://api.github.com/authorizations', | |
| type: 'POST', | |
| beforeSend: function(xhr) { | |
| xhr.setRequestHeader("Authorization", "Basic " + btoa("USERNAME:PASSWORD")); |
This file contains hidden or 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
| // Splice in a string between `begin` and `end` indexes. | |
| // Returns a new string. | |
| function spliceString(string, insert, begin, end) { | |
| return string.slice(0, begin) + insert + string.slice(end); | |
| } | |
| // Search a string with a regular expression, where `step` callback will | |
| // be called at each match, allowing you to perform extra logic and create a | |
| // replacement string. | |
| // |
This file contains hidden or 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
| // Highcharts CheatSheet Part 1. | |
| // Create interactive charts easily for your web projects. | |
| // Download: http://www.highcharts.com/download | |
| // More: http://api.highcharts.com/highcharts | |
| // 1. Installation. | |
| // Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks. | |
| // <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
| // <script src="https://code.highcharts.com/highcharts.js"></script> |
This file contains hidden or 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
| # NPM CheatSheet. | |
| # Super easy intall: npm comes with node now. | |
| # To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html | |
| # More: https://www.npmjs.org/doc/ | |
| # 1. NPM Command Lines. | |
| # Local mode is the default. | |
| # Use --global or -g on any command to operate in global mode instead. |
This file contains hidden or 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
| (* How do to topology in Coq if you are secretly an HOL fan. | |
| We will not use type classes or canonical structures because they | |
| count as "advanced" technology. But we will use notations. | |
| *) | |
| (* We think of subsets as propositional functions. | |
| Thus, if [A] is a type [x : A] and [U] is a subset of [A], | |
| [U x] means "[x] is an element of [U]". | |
| *) | |
| Definition P (A : Type) := A -> Prop. |
This file contains hidden or 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
| /** | |
| * > npm install d3 | |
| */ | |
| // In Node.js, d3.js works in a virtual document provided by jsdom. | |
| var d3 = require('d3'); | |
| //-------- | |
| // Create the SVG element. |
This file contains hidden or 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
| module AI.Search.Examples.Graph where | |
| import Control.Monad | |
| import Control.Monad.ST | |
| import Control.Applicative | |
| import Data.STRef | |
| import Data.Map (Map, (!)) | |
| import qualified Data.Map as Map | |
| import Data.List (nub) | |
| import Data.Graph.Inductive (LNode, LEdge, Gr) |
This file contains hidden or 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
| {-# LANGUAGE NoMonomorphismRestriction #-} | |
| import Text.ParserCombinators.Parsec | |
| import Text.ParserCombinators.Parsec.Token hiding (parens) | |
| import Text.ParserCombinators.Parsec.Expr | |
| import Control.Applicative hiding ((<|>)) | |
| import Control.Monad | |
| import Prelude hiding (not) | |
| data Expr = Not Expr | And Expr Expr | Or Expr Expr | Var Char | SubExpr Expr deriving Eq |