Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Buidling

Bruno Škvorc Swader

🏠
Buidling
View GitHub Profile
@Swader
Swader / teamleaderReturn.php
Created Sep 17, 2012
MyRole Teamleader Return sample
View teamleaderReturn.php
// usersRoles ima polje teamLeaderId. To je accountId od nekog accounta.
// Ako ja uradim $user->getRoles(), i dobijem array MyRoles instanci, onda mogu ovo
// Slanje maila teamleaderu nekog korisnika :
$user->setId(10); // Neki korisnik čijem teamleaderu želimo poslati mail
foreach ($user->getRoles() as $myRole) {
if ($myRole->getRole()->getSlug() == 'author') {
$oTeamLeader = $myRole->getTeamLeader();
@Swader
Swader / postSocialIcons.php
Created Sep 19, 2012
For Drazhen with love <3
View postSocialIcons.php
function post_social_icons() {
echo "<div class='pw-widget pw-size-large'>
   <a class='pw-button-googleplus'></a>
   <a class='pw-button-facebook'></a>
   <a class='pw-button-twitter'></a>
   <a class='pw-button-email'></a>
   <a class='pw-button-post'></a>
</div>
<script src='http://i.po.st/static/script/post-widget.js#publisherKey=71ivmi7rc1d5gkfogd4p' type='text/javascript'></script>
";
View gist:3781256
$oFormRow = \Zend\Form\View\Helper\FormRow();
echo $oFormRow->render($myElement);
// or
echo $oFormRow($myElement)
// Always produces empty markup when used outside zend views. Otherwise works ok.
View .profile
alias sudo='sudo '
alias edit='SUDO_EDITOR="open -FWne" sudo -e'
alias edit_hosts='edit /etc/hosts'
alias edit_httpd='edit /etc/apache2/httpd.conf'
alias edit_php='edit /etc/php.ini'
alias edit_profile='open -e ~/.profile'
alias edit_vhosts='edit /etc/apache2/extra/httpd-vhosts.conf'
alias goto_mw='goto_web; cd mindworks'
@Swader
Swader / idNumbersUsage.php
Created Sep 27, 2012
INTECH - using IdNumbers to get ISBN
View idNumbersUsage.php
$idNumbers = $oRegistry->get('IdNumbers')->setEntity(Entity::STM_PROCESS, $iStmProcessId);
$isbn = $idNumbers->has('isbn') ? $idNumbers->getNumber('isbn') : null;
@Swader
Swader / ServiceManagerUsage.php
Created Oct 7, 2012
Using ZF2 Service Manager
View ServiceManagerUsage.php
public function getServiceConfig()
{
return array(
'factories' => array(
'Pizza' => function ($sm) {
/** @var $sm \Zend\ServiceManager\ServiceManager */
$oObject = new \Application\Model\Pizza();
return $oObject;
},
'Ingredient' => function ($sm) {
View TestApp.scala
package test
object TestApp {
def main (args: Array[String]) {
val p = new HelloWorldPrinter
p.output()
println("Howdy")
}
}
View Printers.scala
package test
abstract class Printer {
def output()
}
class HelloWorldPrinter extends Printer {
def output() {println("Hello World!")}
}
View List.scala
package week4
trait List[T] {
def isEmpty: Boolean
def head: T
def tail: List[T]
}
class Cons[T](val head: T, val tail: List[T]) extends List[T] {
def isEmpty: Boolean = false
@Swader
Swader / manifest.json
Created Nov 7, 2012
Codeskulptor Autosave - Manifest JSON
View manifest.json
{
"name": "Codeskulptor Autosave",
"version": "1",
"manifest_version" : 2,
"description": "Autosave timer for Codeskulptor!",
"background" : { "page" : "background.html" },
"page_action" :
{
"default_icon" : "icon.png",
"default_title" : "Autosave detected you're on Codeskulptor"