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, { Component } from "react"; | |
import { render } from "react-dom"; | |
const Message = ({ text, date }) => ( | |
<div id="message" className="card"> | |
<div className="cell large-4">{text}</div> | |
<div className="cell large-2 text-right"> | |
<small>{date}</small> | |
</div> | |
</div> |
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
def create_image(self, height=50, width=50, format="jpeg"): | |
image = BytesIO() | |
memory_image = Image.new("RGB", (height, width)) | |
memory_image.save(image, format=format) | |
return SimpleUploadedFile(f"test.{format}", image.getvalue(), f"image/{format}") |
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
function handlePossibleError(err) { | |
if (!err) return; | |
console.log('------- ERROR --------'); | |
console.error(err); | |
console.log('----------------------'); | |
} | |
function insertIntoDatabase(db, data) { | |
var tweets = db.collection('tweets'); | |
var reg = /(https:\/\/.+)/g; |
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, { Component } from 'react'; | |
import { createStore } from 'redux' | |
import { Provider, connect } from 'react-redux' | |
// create-react-app specific | |
import logo from './logo.svg'; | |
import './App.css'; | |
const FRAMEWORKS = ['React', 'Angular', 'Vue', 'Ember']; |
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
(function (s) { | |
return [~~(s / 3600), ~~((s % 3600) / 60), s % 60].map(v => v < 10 ? '0' + v : v).join(':'); | |
})([].slice.call(document.querySelectorAll('.duration')) | |
.filter((e, i, a) => ++i <= (a.length / 3)) | |
.map(h => { | |
var t = h.textContent.match(/[0-9]{1,2}:[0-9]{1,2}/); | |
var p = t[0].split(':').map(Number); | |
return (p[0] * 60) + p[1] | |
}).reduce((p, c) => p + c, 0)); |
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
def kebab_to_camel(string): | |
splitted = string.split('-') | |
result = [part.title() for part in splitted[1:]] | |
result.insert(0, splitted[0].lower()) | |
return ''.join(result) |
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
# allow pbcopy | pbpase on OSX | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# set colours | |
set -g default-terminal "screen-256color" | |
# use ctrl+a rather than ctrl+b (capslock == ctrl) | |
unbind C-b | |
set-option -g prefix C-a | |
bind C-a send-prefix |
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
setTimeout(function () { | |
document.location.reload(); | |
}, 1000 * 60 * 5); |
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
source ~/.vundle | |
" -- DEFAULTS -- | |
" UTF-8 encoding | |
set encoding=utf-8 | |
" Default dir is sites | |
cd ~/Appsbroker |
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
source ~/.vundle | |
" -- DEFAULTS -- | |
" UTF-8 encoding | |
set encoding=utf-8 | |
" Default dir is sites | |
cd ~/Appsbroker |
NewerOlder