Skip to content

Instantly share code, notes, and snippets.

View DavidStrada's full-sized avatar
:octocat:
Full StackOverflow Developer

David DavidStrada

:octocat:
Full StackOverflow Developer
View GitHub Profile
{
"npm:bootstrap@4.0.0-alpha.2": {
"files": [ "dist", "fonts", "js", "sass", "package.json" ],
"main": "js/bootstrap",
"shim": {
"js/bootstrap": {
"deps": [ "jquery" ], "exports": "$"
},
"deps": ["thether"],
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.1.6.min.js"></script>
<style id="jsbin-css">
.dimple-example {
@DavidStrada
DavidStrada / User.php
Created December 28, 2015 15:34
user model
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
/**
* The attributes that are mass assignable.
@DavidStrada
DavidStrada / Recursive-list.exs
Created December 26, 2015 01:42
Elixir - Recursive List ( for ? or foreach ).
defmodule Loop do
def printer([]) do
[]
end
def printer(list) do
# len = length list
# IO.puts list?
# if length(list) > 0 do
var callback = [];
for(var i =0; i < 5; i++) {
callback.push( ( i => {
return () => {
console.log(i)
}
})(i) );
}
@DavidStrada
DavidStrada / index.js
Last active August 29, 2015 14:11
requirebin sketch
// example using the raf module from npm. try changing some values!
var $ = require("jquery");
// when using cherrytree you need to create the router, many routes
// and some location implementation. The HistoryLocation keeps router
// state in sync with browser's address bar.
var Router = require("cherrytree");
var Route = require("cherrytree/route");
var HistoryLocation = require("cherrytree/locations/history");
@DavidStrada
DavidStrada / gist:3269058
Last active March 24, 2017 16:15
JS: Animation for a hover with 'mouse direction'
$(".overlayLink").bind("mouseenter mouseleave",function(e){
/** the width and height of the current div **/
var w = $(this).width();
var h = $(this).height();
/** calculate the x and y to get an angle to the center of the div from that x and y. **/
/** gets the x value relative to the center of the DIV and "normalize" it **/
var x = (e.pageX - this.offsetLeft - (w/2)) * ( w > h ? (h/w) : 1 );
var y = (e.pageY - this.offsetTop - (h/2)) * ( h > w ? (w/h) : 1 );