Skip to content

Instantly share code, notes, and snippets.

var el = document.querySelector('main');
let g1 = new Game();
let g2 = new Game();
let g3 = new Game();
let layout = new StackLayout(el);
layout.addItem('g1', g1);
layout.addItem('g2', g2);
layout.addItem('g3', g3);
self.load=function(){
var value = localStorage.getItem('picture');
if ( !value ) { return; }
self.clear();
var img = new Image;
img.src = value;
img.onload = function(){
ctx.drawImage(img,0,0);
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <unistd.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QObject::connect(ui->pushButton, SIGNAL(clicked(bool)), this, SLOT(myfork()));
@ynonp
ynonp / SassMeister-input-HTML.html
Last active October 9, 2015 09:05
Generated by SassMeister.com.
<p>Status:
<span class="my-label label success">Success</span>
</p>
@ynonp
ynonp / SassMeister-input-HTML.html
Created October 9, 2015 06:39
Generated by SassMeister.com.
<ul class="breadcrumbs">
<li><a href="#">Home</a></li>
<li><a href="#">Features</a></li>
<li class="unavailable"><a href="#">Gene Splicing</a></li>
<li class="current"><a href="#">Cloning</a></li>
</ul>
@ynonp
ynonp / SassMeister-input-HTML.html
Created October 8, 2015 06:46
Generated by SassMeister.com.
<a class="my-button">Click Me</a>
@ynonp
ynonp / SassMeister-input-HTML.html
Created October 8, 2015 06:46
Generated by SassMeister.com.
<a class="my-button">Click Me</a>
use strict;
use warnings;
use v5.20;
package ImmutableString {
use Hash::Util qw/lock_hash/;
sub new {
my ($cls, $val) = @_;
@ynonp
ynonp / README.md
Last active July 28, 2017 07:10
react-rails and redux

react-rails and Redux

The main issue I found when integrating react-rails and flux/redux is managing application state. In redux I'd like to have a single application state serialized from the server and parsed in the client, and to use that state to initialize the main store. Something like:

initialState = JSON.parse(window.__APPSTATE__);

But that won't work since react-rails splits its work to 2 phases: it first reads all .js files in the renderer initialize phase and every call to the view helper only calls render.

Solution is described below by using a new renderer that:

@ynonp
ynonp / sub.pl
Created July 5, 2015 06:53
subroutine demo
use strict;
use warnings;
use v5.08;
sub say {
print @_, "\n";
}
say("Hello");