Skip to content

Instantly share code, notes, and snippets.

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

Daniel Bonates dbonates

🏠
Working from home
  • Self Industry
  • Florianopolis, Brazil
View GitHub Profile
@dbonates
dbonates / índex.html
Last active December 17, 2015 00:49
HTML: HTML 5 Template
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>HTML 5 Template</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
</body>
@dbonates
dbonates / populating_database.rb
Created May 6, 2013 16:38
#126 Populating a Database
# bash
gem install populator
gem install faker
rake db:populate
# lib/tasks/populate.rake
namespace :db do
desc "Erase and fill database"
@dbonates
dbonates / teste.json
Created May 9, 2013 05:08
Gist JSON response format
{
"comments": 0,
"comments_url": "https://api.github.com/gists/5526285/comments",
"commits_url": "https://api.github.com/gists/5526285/commits",
"created_at": "2013-05-06T16:38:54Z",
"description": "#126 Populating a Database",
"files": {
"populating_database.rb": {
"content": "# bash\n\ngem install populator\ngem install faker\nrake db:populate\n\n# lib/tasks/populate.rake\n\nnamespace :db do\n desc \"Erase and fill database\"\n task :populate => :environment do\n require 'populator'\n require 'faker'\n \n [Category, Product, Person].each(&:delete_all)\n \n Category.populate 20 do |category|\n category.name = Populator.words(1..3).titleize\n Product.populate 10..100 do |product|\n product.category_id = category.id\n product.name = Populator.words(1..5).titleize\n product.description = Populator.sentences(2..10)\n product.price = [4.99, 19.95, 100]\n product.created_at = 2.years.ago..Time.now\n end\n end\n \n
@dbonates
dbonates / reload.html
Created October 1, 2014 20:29
Live Reload script for gulp.js
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@dbonates
dbonates / gist:818d6cea288a81cf888f
Last active August 29, 2015 14:23
LOGO turtle - SegmentCrossing Codility Task
#import <Foundation/Foundation.h>
// Determine the move in which a LOGO turtle crosses a point that it has already visited
BOOL isBetween(int valueToTest, int limitOne, int limitTwo) {
if (limitOne > limitTwo) {
return (limitTwo <= valueToTest && valueToTest <= limitOne);
} else {
return (limitOne <= valueToTest && valueToTest <= limitTwo);
@dbonates
dbonates / tableview_dumping_cells_animation.swift
Created August 9, 2015 22:37
Tableview scroll dumping cells animation
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
// instead of return perhaps should do a simpler animation
if !tableView.dragging || indexPath.row == movies.count { return }
let mvCell = cell as! MovieTableViewCell
if toTop {
@dbonates
dbonates / teste.css
Created August 11, 2015 11:37
css for popup cubic curve
.popup {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: block;
text-align: center;
margin: 0 auto;
color: #f0c600;
@dbonates
dbonates / blur.scss
Created August 11, 2015 12:08
css blur
input:checked ~ .content {
-webkit-filter: blur(30px);
filter: blur(30px);
}
@dbonates
dbonates / xcode_ramdisk.sh
Created September 26, 2015 13:36 — forked from derjohng/xcode_ramdisk.sh
Create a RAM disk for using with XCode, with Umount disks method
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
[
{
"user_avatar": "http://placehold.it/32/4597CE/F7E42D/&text=FS",
"user_iniciais": "FS",
"user_fullname": "Frank Simpson",
"user_name": {
"last": "Simpson",
"first": "Frank"
},