Skip to content

Instantly share code, notes, and snippets.

@sineld
sineld / laravel-upload-resize.php
Created September 25, 2012 08:11
Laravel File Upload And Resize
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);
@jehoshua02
jehoshua02 / .bash_alias_composer
Created October 4, 2012 05:32
Bash aliases for Composer
alias composer='php composer.phar'
alias composerinit='curl -s http://getcomposer.org/installer | php; composer init; echo composer.phar >> .gitignore'
alias composerdump='composer dumpautoload --optimize'
@ScrambledBits
ScrambledBits / Fetch.jq
Last active February 1, 2016 21:36
Fetch.sublime-settings
{
"files":
{
"Dojo": "http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js",
"MooTools": "http://mootools.net/download/get/mootools-core-1.4.5-full-compat-yc.js",
"PrototypeJS": "https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js",
"jQuery": "http://code.jquery.com/jquery.min.js",
"jQueryUI": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js",
"normalize.css": "https://github.com/necolas/normalize.css/raw/master/normalize.css",
"jquery": "http://code.jquery.com/jquery.min.js",
@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@yyx990803
yyx990803 / nl.sh
Last active March 5, 2024 01:24
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
@demsone
demsone / new_gist_file
Created September 8, 2013 11:24
Google fonts
Lato
<link href='http://fonts.googleapis.com/css?family=Lato:400,300italic,300,100,100italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
font-family: 'Lato', sans-serif;
Open Sans
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300italic,300,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
@afternoon
afternoon / rename_js_files.sh
Created February 15, 2014 18:04
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@roine
roine / controllerSpec.js
Last active May 18, 2016 10:49
Some notes on testing AngularJs with Jasmine and Karma.
describe('controllerCtrl', function () {
var $controller,
$rootScope,
$scope;
beforeEach(module('controller'));
beforeEach(inject(function ($injector) {
$controller = $injector.get('$controller');
$rootScope = $injector.get('$rootScope');
@jeffjohnson9046
jeffjohnson9046 / title-case-filter.js
Created March 26, 2014 18:22
A title-case filter for AngularJs
// Came from the comments here: https://gist.github.com/maruf-nc/5625869
app.filter('titlecase', function() {
return function (input) {
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
input = input.toLowerCase();
return input.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title) {
if (index > 0 && index + match.length !== title.length &&
match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
(title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') &&