Skip to content

Instantly share code, notes, and snippets.

View crisu83's full-sized avatar
🎩
Coding

Christoffer Niska crisu83

🎩
Coding
View GitHub Profile

Keybase proof

I hereby claim:

  • I am crisu83 on github.
  • I am crisu83 (https://keybase.io/crisu83) on keybase.
  • I have a public key whose fingerprint is CDFF 120A EF75 054B 8C91 EA42 9FA1 2D05 9A4A 407B

To claim this, I am signing this object:

<?php namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class UserController extends Controller {
/**
* Store a new user.
*
@crisu83
crisu83 / status.php
Created April 19, 2015 07:09
Immutable status class.
<?php
class Status
{
const PUBLISHED = 10;
const DRAFT = 20;
private $status;
public static function published()
{
<?php
namespace nord\yii\imagemanager\providers\cloudinary;
use Cloudinary;
use Cloudinary\Uploader;
use nord\yii\imagemanager\services\ProviderInterface;
use yii\base\Component;
class Provider extends Component implements ProviderInterface
@crisu83
crisu83 / phaser.js
Created June 25, 2014 07:03
Wrapper module for running Phaser.js on Node.js.
// this is an ingenius hack that allows us to run Phaser without a browser
// ... and yes, it took some time to figure out how to do this
var Canvas = require('canvas')
, jsdom = require('jsdom')
, document = jsdom.jsdom(null)
, window = document.parentWindow
, Phaser;
// expose a few things to all the modules
@crisu83
crisu83 / dip_bot.js
Created May 5, 2014 11:03
Small script that will help you play "Drowning in Problems" by Notch http://game.notch.net/drowning/#
/*
Open up the developer console in your browser, paste the script below, press enter and enjoy!
*/
var anchors, i;
setInterval(function() {
anchors = document.getElementsByTagName('a');
for (i = 0; i < anchors.length; i++) {
anchors[i].click();
}
$ grunt watch:styles
Running "watch:styls" (watch) task
Waiting...OK
>> File "less/main.less" changed.
Running "less/app" (less) task
File css/main.css created.
Running "watch:styles" (watch) task
<?php
function checkAccess($roleName)
{
if (Yii::app()->user->checkAccess('Developer') || Yii::app()->user->checkAccess('SuperAdmin')) {
// devs and sa always has access to all models.
return true;
} elseif (Yii::app()->user->checkAccess($roleName)) {
// user has access if he belongs to the same group
return $this->createGroupAccessCriteria(Yii::app()->user->id);
<?php
/**
* @param string|array $content
*
* When passed as array:
* - heading: string|array
* - subtext: string
*
* @param array $options
*
/*
* DOMParser HTML extension
* 2012-09-04
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */