Skip to content

Instantly share code, notes, and snippets.

@janusnic
janusnic / .gitignore
Created July 30, 2016 15:39 — forked from jdsteinbach/.gitignore
Sass+PostCSS
node_modules
@janusnic
janusnic / SerializableModel.php
Last active October 28, 2015 03:21 — forked from ternavsky/SerializableModel.php
OctoberCMS Model behavior that allows to store some model's attributes in json format in grouping fields in db.
<?php namespace Path\To\Behaviors;
use System\Classes\ModelBehavior;
/**
* Model behavior that allows to store some model's attributes
* in json format in grouping fields in db.
*
* USAGE: In your model add
*
def moduleinit():
"""Make sure various environment variables are set correctly
"""
if 'MODULE_VERSION' not in os.environ:
os.environ['MODULE_VERSION_STACK'] = '3.2.10'
os.environ['MODULE_VERSION'] = '3.2.10'
else:
os.environ['MODULE_VERSION_STACK'] = os.environ['MODULE_VERSION']
os.environ['MODULESHOME'] = '/usr/share/Modules/3.2.10'
VAGRANTFILE_API_VERSION = "2"
path = "#{File.dirname(__FILE__)}"
require 'yaml'
require path + '/scripts/homestead.rb'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
Homestead.configure(config, YAML::load(File.read(path + '/Homestead.yaml')), Vagrant.has_plugin?('vagrant-hostsupdater'))
end
@janusnic
janusnic / admin.py
Last active August 29, 2015 14:22 — forked from elidickinson/admin.py
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
# Note: we are renaming the original Admin and Form as we import them!
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms
from ckeditor.widgets import CKEditorWidget
@janusnic
janusnic / admin.py
Last active August 29, 2015 14:22 — forked from elidickinson/admin.py
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
# Note: we are renaming the original Admin and Form as we import them!
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms
from ckeditor.widgets import CKEditorWidget
@janusnic
janusnic / raskell.rb
Last active August 29, 2015 14:22 — forked from andkerosine/raskell.rb
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@janusnic
janusnic / IEEE754.rb
Last active August 29, 2015 14:22 — forked from domgetter/IEEE754.rb
bits = eval("0x" + [0.15625].pack('g').unpack('H16')[0]).to_s(2).rjust(32,"0")
#=> "00111110001000000000000000000000"
# these are the bits of 0.15625 represented as a single precision float
sign = bits[0]
#=> "0"
exponent = bits[1..8]
#=> "01111100"
mantissa = bits[9..32]
#=> "01000000000000000000000"
sign = sign.to_i == 0 ? 1 : -1
@janusnic
janusnic / bower.json
Last active August 29, 2015 14:21 — forked from Bersam/bower.json
{
"name": "bersam",
"homepage": "http://bersam.org",
"authors": [
"Bersam Karbasion <[email protected]>"
],
"license": "MIT",
"private": true,
"dependencies": {
"modernizr": "2.8.2",
//
// SmoothScroll for websites v1.2.1
// Licensed under the terms of the MIT license.
//
// You may use it in your theme if you credit me.
// It is also free to use on any individual website.
//
// Exception:
// The only restriction would be not to publish any
// extension for browsers or native application