Skip to content

Instantly share code, notes, and snippets.

Avatar
🎩
Coding

Christoffer Niska crisu83

🎩
Coding
View GitHub Profile
View html-domparser.js
/*
* 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 */
View Html::pageHeader.php
<?php
/**
* @param string|array $content
*
* When passed as array:
* - heading: string|array
* - subtext: string
*
* @param array $options
*
View checkAccess.php
<?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);
View grunt.sh
$ 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
View CloudinaryProvider
<?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
View UserController.php
<?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 Apr 19, 2015
Immutable status class.
View status.php
<?php
class Status
{
const PUBLISHED = 10;
const DRAFT = 20;
private $status;
public static function published()
{
View keybase.md

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:

View UserMapping.xml
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
<entity name="App\Entities\User" table="users">
<id name="surrogateId" type="integer" column="id">
<generator strategy="AUTO" />
</id>
<field name="id" type="string" column="identity" />
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Web server configuration
config.vm.define "web" do |web|
web.vm.box = "nordsoftware/nginx-php-nvm"