Skip to content

Instantly share code, notes, and snippets.

View mladen's full-sized avatar
🌄
Dreaming about mountains and highlands.

Mladen Krivaćević mladen

🌄
Dreaming about mountains and highlands.
View GitHub Profile
@mladen
mladen / vagrant-cheat-sheet.md
Created October 2, 2018 13:39 — forked from wpscholar/vagrant-cheat-sheet.md
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@mladen
mladen / gist:79aaf56d301a44a48d8b
Created March 24, 2016 11:22 — forked from gbarrancos/gist:3277138
7 Tips for Successful Self Learning

7 Tips for Successful Self Learning - by Bradford Cross

No matter what, you're going to have to learn most everything on your own anyway. Self-learning is hard. Regardless of where, when or how you learn - being a good self-learner will maximize your potential.

In this post, Hamilton Ulmer (an almost-done Stanford stats masters student) and I, will explore seven ways to become a great self-learner.

The longest path is the shortest and the shortest path is the longest

// The ID() function will return a unique number every time you call.
// Code is from http://qnimate.com/generate-unique-number-in-javascript/
function uniqueNumber() {
var date = Date.now();
if (date <= uniqueNumber.previous) {
date = ++uniqueNumber.previous;
} else {
uniqueNumber.previous = date;
}
@mladen
mladen / _mixins.scss
Last active August 29, 2015 14:24 — forked from garyharan/_mixins.scss
@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;
}
var Artist = Backbone.Model.extend();
var Artists = Backbone.Collection.extend({
model : Artist,
url : "http://api.discogs.com/database/search?type=artist",
sync : function(method, collection, options) {
// By setting the dataType to "jsonp", jQuery creates a function
// and adds it as a callback parameter to the request, e.g.:
// [url]&callback=jQuery19104472605645155031_1373700330157&q=bananarama
// If you want another name for the callback, also specify the
// backbone.js continues to impress, I needed to get data from a jsonp api
// I really wanted to do this the "right" backbone.js way and create a model and call fetch.
// But the default backbone synch is not jsonp
// Turns out you can override a synch on a per model basis (thanks stackoverflow)
// whats nice is backbone.js continue to work as expected with the override
// here's a snippet (some changes to protect our privacy). An improvement could be to create a jsonp model class which MyModel inherits
// the synch function is most important below, that's what tells backbone it's jsonp
MyModel = Backbone.Model.extend({
<!--
English:
This example show how do a simple MVVM code with html+js
You can change the data in design and the object person will be changed, you can too make the change by the console(js) of the property from the object and the visual will be changed.
Portugues:
Esse exemplo mostra como fazer um simples MVVM framework com HTML e JS
Você pode alterar os dados visualmente e o objeto pessoa vai ser alterado e também se você fizer a alteração via console da propriedade o visual será modificado.
-->
<!DOCTYPE html>
<html>
// by d whyte
int[][] result;
float t;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@mladen
mladen / cs.js
Last active August 29, 2015 14:07 — forked from blasten/cs.js
// Build a tree using a compacted object with no pointer for the left/right children
function buildTree(A) {
// Shuffle the array. so we gain a more balance search tree
A.sort(function() { return parseInt(Math.random()*3) - 1; });
var tree = {'0': A[0]}, current = 1;
var inserted, node, treeSize = 1;
// This will take O(N * log N) if we have a balanced tree
// the worst case cost will be O(N^2)

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users