Skip to content

Instantly share code, notes, and snippets.

View thomas-lebeau's full-sized avatar
🐶

Thomas Lebeau thomas-lebeau

🐶
View GitHub Profile
@thomas-lebeau
thomas-lebeau / index.js
Created February 8, 2020 13:14
todoList2
import React, { Component } from "react";
import ReactDom from "react-dom";
const doneStyles = {
textDecoration: "line-through",
color: "grey"
};
const buttonStyles = {
border: "none",
@thomas-lebeau
thomas-lebeau / index.js
Created February 8, 2020 12:02
Martian photo fetcher
import React, { Component } from "react";
import ReactDOM from "react-dom";
const wait = response =>
new Promise(resolve => setTimeout(() => resolve(response), 3000));
const handleErrors = response => {
if (response.status < 200 || response.status >= 300) {
throw new Error("Network Error");
}
import React, { Component } from "react";
import ReactDOM from "react-dom";
function Todo(props) {
const { text, isDone, onToggle } = props;
const style = isDone ? { color: "grey", textDecoration: "line-through" } : {};
return (
<li>
<input
@thomas-lebeau
thomas-lebeau / clock.js
Created February 4, 2020 18:26
migracode clock ticking
import React, { Component } from "react";
import ReactDOM from "react-dom";
class Time extends Component {
constructor(props) {
super(props);
this.state = {
date: new Date(),
count: 0
};
@thomas-lebeau
thomas-lebeau / social-share.js
Created July 17, 2015 15:00
Share to social network
'use strict';
(function () {
/**
* Social share popups
*
*/
var url = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
var title = document.getElementsByTagName("title")[0].innerHTML;
@thomas-lebeau
thomas-lebeau / gist:fa98c485ab7135cd0473
Last active August 29, 2015 14:24
kirby get first parent
$blog = ($page->parents()->count() > 0)? $page->parents()->first() : $page;
@thomas-lebeau
thomas-lebeau / user.php
Created April 30, 2015 08:54
Override kirby user field to select current user by default
<?php
class UserField extends SelectField {
public function input() {
$select = new Brick('select');
$select->addClass('selectbox');
$select->attr(array(
'name' => $this->name(),
@thomas-lebeau
thomas-lebeau / gist:ae8ba7548c8f89a07b6d
Created April 17, 2015 14:49
Boostrap 3 Media Queries Cheat Sheet
/* no media query is for phone and larger (mobile first) */
@media only screen and (min-width: @screen-sm-min) {} /* tablet (768px) and larger */
@media only screen and (min-width: @screen-md-min) {} /* desktop (992px) and larger */
@media only screen and (min-width: @screen-lg-min) {} /* wide destop (1200px) and larger */
@media only screen and (max-width: @screen-xs-max) {} /* phone (767px) and smaller */
@media only screen and (max-width: @screen-sm-max) {} /* tablet (991px) and smaller */
@media only screen and (max-width: @screen-md-max) {} /* desktop (1199px) and smaller */
/* no media query is also for wide desktop and smaller */
@thomas-lebeau
thomas-lebeau / gist:aff093cf6b6386c8fd08
Last active August 29, 2015 14:19
Fire event when window resizing is finished
var resizeId;
$(window).resize(function() {
clearTimeout(resizeId);
resizeId = setTimeout(doneResizing, 500);
});
function doneResizing(){
//whatever we want to do
}
@thomas-lebeau
thomas-lebeau / gist:3e3ff2b32a040cac87e3
Created April 17, 2015 11:29
Makes placeholder disappear immediately on focus
[placeholder]:focus::-webkit-input-placeholder {
color: transparent;
}