Skip to content

Instantly share code, notes, and snippets.

Avatar

Piotr Sarnacki drogus

View GitHub Profile
@drogus
drogus / Dockerfile
Created Dec 2, 2018
AWS lambda rust
View Dockerfile
FROM amazonlinux:2017.03.1.20170812-with-sources
RUN curl https://sh.rustup.rs -sSf | /bin/sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup install nightly
RUN yum install -y gcc gcc-c++ make openssl openssl-devel
RUN mkdir /code
WORKDIR /code
View components.xss-test.js
import Ember from 'ember';
export default Ember.Component.extend({
name: Ember.computed(function() {
return `<h1 style="color: red">pwnd</h1>`;
}),
xss: Ember.computed(function() {
return Ember.String.htmlSafe("<b>" + Ember.Handlebars.Utils.escapeExpression(this.get('name')) + "</b>");
})
@drogus
drogus / controllers.application.js
Created Feb 20, 2017
router-basic-route-inheritance-exampl
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View trigger-build.md

Requesting a build through the API can be done by sending a POST request to a /repo/{slug|id}/requests path.

Here is script for sending minimal request to a travis-ci/travis-core repository, for a master branch:

body='{
"request": {
  "branch":"master"
}'
View sound.py
#!/usr/bin/env python
import time
from pyo import *
s = Server(duplex=0).boot()
s.start()
left = [
Sine( phase = 0.25, freq = 400, mul = 0.5 ),
View Setting longer HTTP timeout in capybara
Capybara.register_driver :selenium_with_long_timeout do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120
Capybara::Selenium::Driver.new(app, :browser => :firefox, :http_client => client)
end
Capybara.javascript_driver = :selenium_with_long_timeout
@drogus
drogus / post_form.rb
Last active Aug 29, 2015
form objects
View post_form.rb
class PostForm
include Virtus.model
extend ActiveModel::Naming
include ActiveModel::Validations
attribute :id, Integer
attribute :title, String
attribute :body, String
validates :title, presence: true
View gist:10368834
this.resource("restaurants")
this.resource("restaurant", { path: "/restaurants/:restaurant_id" }, function () {
this.resource("bookings", function () {
this.route("new");
});
this.resource("booking", { path: "/bookings/:booking_id" });
});
View 2-elements-per-iteration.hbs
<table>
{{#for post in posts}}
<tr><td>First row</td></tr>
<tr><td>Second row</td></tr>
{{/for}}
</table>
View 01_sketelon.html
<!doctype html>
<html>
<head>
<title>My Little Webapp: Coding Is Magic</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://rawgithub.com/krzysztofbialek/Rails-Girls-Warsaw-App/master/style.css" />
</head>
<body>
</body>
</html>