Skip to content

Instantly share code, notes, and snippets.

@ptsakyrellis
ptsakyrellis / AppKernel.php
Created March 16, 2018 15:56
Symfony AppKernel cache and log directories change
<?php
public function getCacheDir()
{
if (in_array($this->environment, array('dev', 'test'))) {
return '/dev/shm/votre_appli/cache/' . $this->environment;
}
return parent::getCacheDir();
}
@ptsakyrellis
ptsakyrellis / UIView+.swift
Created March 25, 2016 15:54
UIView extension to programmatically round specific corners of an UIView
extension UIView {
/**
Rounds the given set of corners to the specified radius
- parameter corners: Corners to round
- parameter radius: Radius to round to
*/
func roundCorners(corners: UIRectCorner, radius: CGFloat) {
_roundCorners(corners, radius: radius)
}
@ptsakyrellis
ptsakyrellis / UIFont+.swift
Created March 14, 2016 21:15
UIFont extensions to be able to get bold and bold italic fonts directlky from a UIFont object
/**
UIFont extensions to be able to get bold and bold italic fonts directlky
from a UIFont object
*/
import Foundation
import UIKit
extension UIFont {
func withTraits(traits:UIFontDescriptorSymbolicTraits...) -> UIFont {
@ptsakyrellis
ptsakyrellis / UICollection+.swift
Created March 14, 2016 21:14
CollectionType and MutableCollectionType extensions to be able to easily shuffle items
/**
CollectionType and MutableCollectionType extensions to be able to easily shuffle
items
*/
import Foundation
extension CollectionType {
/// Return a copy of "self" with its elements shuffled
func shuffle() -> [Generator.Element] {
var list = Array(self)
@ptsakyrellis
ptsakyrellis / ArrayDataSource.swift
Created February 15, 2016 15:17
Swift Class aimed to simplify the implementation of datasource methods for table or collection views where the data is an array.
/**
Class aimed to simplify the implementation of datasource methods for table or collection
views where the data is an array.
This allows us to re-use code and slim our view Controllers.
*/
import Foundation
import UIKit
class ArrayDataSource<CellType: UIView, ItemType>: NSObject, UITableViewDataSource, UICollectionViewDataSource {
var items: [ItemType]
@jaytaph
jaytaph / composer.json
Created January 15, 2016 09:30
Using the Symfony security component as standalone
{
"name": "jaytaph/security-example",
"require": {
"symfony/security-core": "~2.8"
},
"authors": [
{
"name": "Joshua Thijssen",
"email": "jthijssen@noxlogic.nl"
}
@four43
four43 / install-redis.sh
Last active April 18, 2021 04:03 — forked from dstroot/install-redis.sh
Install Redis
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/four43/e00d01ca084c5972f229/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"