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
<?php | |
namespace Drupal\mail_login_rpc\Routing; | |
use Drupal\Core\Routing\RouteSubscriberBase; | |
use Symfony\Component\Routing\RouteCollection; | |
/** | |
* Swaps default rpc login controller with ours. | |
*/ |
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
'''Cycles keyboard brightness levels using DBus.''' | |
import dbus | |
def main(): | |
bus = dbus.SystemBus() | |
proxy = bus.get_object('org.freedesktop.UPower', | |
'/org/freedesktop/UPower/KbdBacklight') | |
interface = dbus.Interface(proxy, 'org.freedesktop.UPower.KbdBacklight') | |
current_level = interface.GetBrightness() |
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
const { Server } = require('boardgame.io/server'); | |
const { TicTacToe } = require('gamux-tictactoe'); | |
const logger = require('koa-logger'); | |
const cors = require('koa-cors'); | |
const server = Server({ games: [ TicTacToe ] }); | |
server.app.use(logger()); | |
server.app.use(cors()); |
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
Show hidden characters
{ | |
"env": { "browser": true }, | |
"extends": [ | |
"airbnb", | |
"prettier", | |
"prettier/react", | |
"plugin:jest/recommended" | |
], | |
"overrides": [ | |
{ |
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
#!/bin/bash - | |
set -o nounset # Treat unset variables as an error | |
for filename in *.jpg; do | |
curl -H "X-API-Key: ${API}" -F "image_file=@./${filename}" -f https://api.remove.bg/v1.0/removebg -o "nobg_${filename}.png"; | |
done |
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
/* eslint-disable */ | |
import Phaser from 'phaser'; | |
class Breakout extends Phaser.Scene { | |
constructor() { | |
super({ key: 'breakout' }); | |
} | |
preload() { | |
this.load.atlas('assets', 'static/assets/breakout.png', 'static/assets/breakout.json'); |
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
# coding: utf-8 | |
def extrair_propriedade(propriedade): | |
dados = propriedade.css('::text').extract()[1:] | |
return [dado.strip() for dado in dados] | |
ficha = response.css('.ficha-tecnica li') | |
propriedades = [extrair_propriedade(propriedade) for propriedade in ficha] | |
item = { "url": response.url, "preco": 123 } | |
item.update(dict(propriedades)) |
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::io; | |
fn get_guess() -> i32 { | |
let mut guess = String::new(); | |
io::stdin() | |
.read_line(&mut guess) | |
.expect("Failure reading input."); | |
match guess.trim().parse::<i32>() { | |
Ok(number) => number, |
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
import { connect } from 'react-redux'; | |
const Score = ({ score }) => (<div className="game-score"> {score} </div>); | |
const mapStateToProps = (state) => ({ score: state.game.score }); | |
export default connect(mapStateToProps)(Score) | |
/*******************************/ | |
import { connect } from 'react-redux'; |
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
import React from 'react'; | |
import axios from 'axios'; | |
import spinner from '../assets/spinner.gif'; | |
class Library extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { books: [], loading: false } | |
} |