Skip to content

Instantly share code, notes, and snippets.

@baniol
baniol / split_username.sql
Last active December 17, 2015 03:59
mysql split username, string
-- Splits username by first space, shortens first name to the first letter & adds a dot. Ex.: Jonh Smith -> J. Smith
SELECT CONCAT(CONCAT(LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX( `username` , ' ', 2 ),' ',1),1),"",". ") ," ", SUBSTRING_INDEX(SUBSTRING_INDEX( `username` , ' ', -1 ),' ',2)) AS user
FROM tbl_name
@baniol
baniol / terminal_varia.sh
Created May 10, 2013 08:19
terminal varia
# highighting grep
grep --color -E "string" file
var casper = require('casper').create();
casper.start();
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)');
casper.viewport(1024, 768);
casper.thenOpen('http://jsbin.com/ifuma#noedit', function() {
this.capture('test.png');
@baniol
baniol / controller.php
Last active December 17, 2015 10:49
example laravel controller & view (layout);
// taken from : http://forums.laravel.io/viewtopic.php?id=839
class Blog_Controller extends Controller
{
public $layout = 'layouts.default';
public function action_index()
{
$this->layout->title = "Blog";
@baniol
baniol / casperutils.js
Created May 22, 2013 12:28
functional tests for laravel gotin bundle
module.exports = {
login: function(casper, url, user, password, cont) {
if (cont === undefined) {
casper.start(url, function() {
this.test.info('Logging in user: ' + user);
this.fill('#login-form', {
'email-login': user,
'password-login': password
@baniol
baniol / Gruntfile.js
Created June 5, 2013 22:01
grunt file for development: coffescript, sass, connect
module.exports = function(grunt) {
// 'use strict'
grunt.initConfig({
sass: {
dist: {
files: {
'css/prezenter.css': 'sass/prezenter.scss'
}
},
@baniol
baniol / mixins.scss
Last active December 18, 2015 04:49
a few useful sass mixins, css, ui
// https://gist.github.com/garyharan/957284
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
@baniol
baniol / todo.coffee
Created June 11, 2013 10:45
todo app angular coffeescript
# Original source at: http://angularjs.org/#todo-js
window.TodoCtrl = ($scope) ->
$scope.todos = [
{text: 'learn angular', done: true},
{text: 'build an angular app', done: false}
]
$scope.addTodo = ->
@baniol
baniol / app.js
Created June 11, 2013 10:45 — forked from rktjmp/app.js
angular module coffeescript
// Make our app module, its easier to do this in raw javascript
// and then put the rest of our app content (controllers etc)
// in their own coffeescript files.
//
// Your ng-app should include this module name, eg: <html ng-app="TodoApp">
angular.module('TodoApp', []);
@baniol
baniol / css-responsive-snippets.css
Created June 22, 2013 15:13
css responsive image, img
img{
max-width:100%;
height:auto;
}