Skip to content

Instantly share code, notes, and snippets.

View KCreate's full-sized avatar
🍰
the cake is a lie

Leonard Schütz KCreate

🍰
the cake is a lie
View GitHub Profile
@KCreate
KCreate / Inverter.js
Created March 26, 2016 20:43
React inverter
var Inverter = React.createClass({
getInitialState: function() {
return {
text: ""
};
},
textChange: function(event) {
this.setState({
text: event.target.value
});
@KCreate
KCreate / EasyQuery.php
Created February 26, 2016 08:59
EasyQuery
// Easier sql queries
class EasyQuery {
private $dbname;
private $db;
public function __construct($dbname) {
$this->dbname = $dbname;
// Check if the db file exists
if (!file_exists($this->dbname)) {
@KCreate
KCreate / objectmap.js
Created January 11, 2016 07:28
Object map functions
/*
Iterate over an object
*/
Object.prototype.map = function(cb) {
Object.keys(this).map(function(item) {
if (this.hasOwnProperty(item)) {
this[item] = cb(item, this[item], this);
}
}.bind(this));
return this;
@KCreate
KCreate / solver.coffee
Created December 9, 2015 15:11
playcodemonkey.com universal solver
[bananas].map (item) ->
item.map (item) ->
item.defaultValues=monkey.defaultValues
@KCreate
KCreate / asyncAlert.js
Created November 22, 2015 11:51
Asynchronous JavaScript Alert
function asyncAlert(m){
setTimeout(function(){
alert(m);
},1);
};