Let's declare a function that explicitly throws an error
hehe = ->
throw new Error "OMFG"
Let's simulate some behavior within Promise's constructor
<?php | |
class Octopus { | |
public $results = array(); | |
public $urls = array(); | |
public $chs = array(); | |
public $mh = null; | |
public function __construct() { |
#Add these commands to the file | |
echo "\n" | |
echo "********************" | |
echo "Post receive hook: Updating website" | |
echo "********************" | |
echo "\n" | |
#Change to working git repository to pull changes from bare repository | |
cd /home/topfriends/www || exit | |
unset GIT_DIR |
<?php | |
class Users implements JsonSerializable{ | |
private $_data = array(); | |
public function addUser(User $user){ | |
$this->_data[] = $user; | |
} | |
public function jsonSerialize(){ | |
return $this->_data; | |
} |
<link rel="import" href="../paper-input/paper-input.html"> | |
<link rel="import" href="../paper-progress/paper-progress.html"> | |
<link rel="import" href="../paper-button/paper-button.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; |
try { | |
if (empty($_POST["name"])) { | |
throw new UserRegistrationException("Your name cannot be empty."); | |
} | |
if (filter_var($_POST["email"])) { | |
throw new UserRegistrationException("Invalid email"); | |
} | |
} catch (UserRegistrationException $e) { | |
} |
<link rel="import" href="../ace-element/ace-element.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; | |
height: 100%; |
Let's declare a function that explicitly throws an error
hehe = ->
throw new Error "OMFG"
Let's simulate some behavior within Promise's constructor
highlight = require 'highlight.js' | |
cheerio = require 'cheerio' | |
color-it = (code, lang) -> | |
html = (highlight.highlight lang, code).value | |
$ = cheerio.load("<div id=\"the-wrapper\">#{html}</div>") | |
elements = [] | |
($ '#the-wrapper *').each -> |
var validator = require('validator') | |
, R = require("ramda") | |
, Promise = require("bluebird"); | |
var skip = R.defaultTo(null); | |
var pairObjectify = R.pipe( | |
R.splitEvery(2), | |
R.map(x => ({key: R.head(x), value: R.last(x)})) | |
); |
<?php | |
/** | |
* Generate an array with $quantity random numbers from the given range (from $x to $y) | |
* @param int $min | |
* @param int $max | |
* @param int $quantity | |
* @return array | |
*/ | |
function generateNumbers($min, $max, $quantity) { |