Skip to content

Instantly share code, notes, and snippets.

View althaus's full-sized avatar
🏠
Working from home

Matthias Althaus althaus

🏠
Working from home
View GitHub Profile

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@vorushin
vorushin / jquery-csrf.js
Created June 24, 2011 08:51
Small jQuery plugin for adding csrf-token to Ajax/Ajaj requests
$.ajaxSetup({
beforeSend: function(xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
@jmather
jmather / SiteListBuilder.php
Created August 14, 2011 06:43
How to link a many-to-many properly in Symfony2 with Sonata Admin Bundle
<?php
namespace Majax\PortalBundle\Builder;
use Symfony\Bundle\DoctrineBundle\Registry;
class SiteListBuilder {
/** @var \Symfony\Bundle\DoctrineBundle\Registry */
private $orm;
public function __construct($orm)
@betweenbrain
betweenbrain / gist:2284129
Created April 2, 2012 14:56
Git command to export only changed files between two commits
git archive --output=file.zip HEAD $(git diff --name-only SHA1 SHA2)
@nblumoe
nblumoe / angularjs_resource_tokenhandler.js
Created July 5, 2012 07:34
AngularJS service to send auth token with $resource requests
.factory('TokenHandler', function() {
var tokenHandler = {};
var token = "none";
tokenHandler.set = function( newToken ) {
token = newToken;
};
tokenHandler.get = function() {
return token;
@nielsmouthaan
nielsmouthaan / MenuBuilder.php
Created September 22, 2012 10:21
Custom KnpMenuBundle navigation bar twig template to support Font Awesome icons & Twitter bootstrap lay-out
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@bjo3rnf
bjo3rnf / EntityHiddenType.php
Last active November 19, 2021 17:19
Hidden field for Symfony2 entities
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
@fguillen
fguillen / nice_file_field.js
Last active February 22, 2019 18:33
Pretty 'input[type="file"]' for Bootstrap addicts
// Based in: http://duckranger.com/2012/06/pretty-file-input-field-in-bootstrap/
// Version: 0.0.3
// Compatibility with: Bootstrap 3.2.0 and jQuery 2.1.1
// Use:
// <input class="nice_file_field" type="file" data-label="Choose Document">
// <script> $(".nice_file_field").niceFileField(); </script>
//
(function( $ ) {
$.fn.niceFileField = function() {
this.each(function(index, file_field) {
@dexterca
dexterca / glyphicons-pro.less
Last active December 15, 2015 19:49
The glyphicons-pro.less file is intended to bolt onto Twitter Bootstrap and includes classes for the GLYPHICONS PRO icon set. The GLYPHICONS PRO set contains 470+ icons. This file is compatible with Twitter Bootstrap v3+ A GLYPHICONS PRO license is required. Once a license is purchased, download the appropriate font files (glyphicons-regular.eot…
//
// Glyphicons 1.8.1
// -----------------------------------------------------------------------------
// About
//
// Glyphicons font-based icons require you to include all relevant font files,
// found in the Bootstrap repo under /fonts/. Files are referenced relative to
// the compiled CSS.
//