Skip to content

Instantly share code, notes, and snippets.

<?php
public static function RebuildGameCaches($game_id) {
wikilog("RebuildGameCaches started");
$game = database_find_by('games', ['game_id' => $game_id]);
$records = database_filter_by('records', ['game_id' => $game_id]);
// $levels information is not loaded in $records using a join on purpose
// to reduce memory usage.
$levels = index_by(database_fetch_all("
<?php
require_once("tests/TestHelper.php");
use Symfony\Component\DomCrawler\Crawler;
test('pages/home/index', function () {
global $_SESSION;
$_SESSION = [];
{
"dependencies": {
"express": "^4.16.4",
"selfsigned": "^1.10.4",
"spdy": "^4.0.0"
}
}
#!/usr/bin/env bash
set -e
base_url="https://releases.hashicorp.com/terraform"
latest_version="$(curl --silent "https://releases.hashicorp.com/terraform/" | sed -ne 's/.*<a href="\/terraform\/\(.*\)\/".*/\1/p' | grep -v "rc\|beta" | head -n1)"
current_version="$(terraform -v | sed -ne 's/Terraform v\(.*\)/\1/p')"
if [ "$latest_version" != "$current_version" ]; then
GET / endpoints
GET /meetups index-meetups
POST /meetups create-meetup signed-in
GET /meetups/porto-codes show-meetup
PUT /meetups/porto-codes update-meetup owns-meetup-or-is-operator
POST /session send-login-email
GET /talks/porto-codes index-talks
@hugopeixoto
hugopeixoto / main.c
Last active June 13, 2017 23:23
simple color picker
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <stdio.h>
int main() {
int x = 0;
int y = 0;
Display* display = NULL;
import Ember from 'ember';
export default Ember.Component.extend({
filter: null,
filteredPeople: Ember.computed('people', 'filter', function() {
if (this.get("filter") === null) {
return this.get("people");
} else {
return this.get("people").filter(
(person) => parseInt(person.height, 10) <= this.get("filter"),
"use strict";
var Root = class {
constructor(name) { this.name = name; this.getName = this.getName.bind(this); }
getName() { return this.name; }
getNameOrig() { return this.name; }
};
var Child = class extends Root { }
#!/usr/bin/env sh
assert() {
R="$(tico "$1")"
if [ ! "$R" = "$2" ]; then
echo "error on tico $1"
echo " expected $2"
echo " actual $R"
exit 1
fi
@hugopeixoto
hugopeixoto / xpto.sh
Created May 16, 2016 09:35
activate for python and npm
activate() {
py=".env/bin/activate"
[ -f "$py" ] && . "$py"
js="node_modules"
if [ -d "$js" ]; then
export _PREV_PATH_WITHOUT_NPM="$PATH"
export _PREV_PS1_WITHOUT_NPM="$PS1"
export PATH="$(npm bin):$PATH"