Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ever Daniel Barreto everdaniel

🏠
Working from home
View GitHub Profile
@everdaniel
everdaniel / ex.js
Created Jan 21, 2016 — forked from JeffreyWay/ex.js
Laracasts.com Episode: Algolia + JavaScript + Vue
View ex.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Algolia with JS</title>
<link rel="stylesheet" href="app.css">
</head>
<body>
View rds_backup.sh
#!/bin/bash
SNAPID="SNAP"
BACKUPDBID="TEMPDB"
#config groups
SECURITYGROUP="Mysecgrup"
PARAMSGROUP="Myparamsgrup"
#rds verifying commands
View gist:11269430
if( $('#map2').length > 0) {
var map2 = $('#map2'),
map_lat2 = map2.data('lat'),
map_ing2 = map2.data('ing');
// init the map and create a cluster with some markers
$('#map2').gmap3({
map:{
options:{
center:[map_lat2,map_ing2],
@everdaniel
everdaniel / driving.html
Created Apr 23, 2014
Driving Directions / v2
View driving.html
<p>Get driving directions from your neighborhood:</p>
<a href="#" class="driving-directions" data-origin="Wattle Glen, Diamond Creek, Victoria 3089">From Wattle Glen</a>
<a href="#" class="driving-directions" data-origin="Watsonia, Diamond Creek, Victoria 3089">From Watsonia</a>
<a href="#" class="driving-directions" data-origin="St Helena, Diamond Creek, Victoria 3089">From St Helena</a>
<a href="#" class="driving-directions" data-origin="Plenty, Diamond Creek, Victoria 3089">From Plenty</a>
<a href="#" class="driving-directions" data-origin="Montmorency, Diamond Creek, Victoria 3089">From Montmorency</a>
<a href="#" class="driving-directions" data-origin="Hurstbridge, Diamond Creek, Victoria 3089">From Hurstbridge</a>
<a href="#" class="driving-directions" data-origin="Bundoora, Diamond Creek, Victoria 3089">From Bundoora</a>
<a href="#" class="driving-directions" data-origin="Doreen, Diamond Creek, Victoria 3089">From Doreen</a>
<a href="#" class="driving-directions" data-origin="Eltham, Diamond Creek, Vic
@everdaniel
everdaniel / gmap3.js
Created Apr 23, 2014
Driving Directions / GMap3
View gmap3.js
var destinations = new Array();
destinations.push('Wattle Glen, Diamond Creek, Victoria 3089');
destinations.push('Watsonia, Diamond Creek, Victoria 3089');
destinations.push('St Helena, Diamond Creek, Victoria 3089');
destinations.push('Plenty, Diamond Creek, Victoria 3089');
destinations.push('Montmorency, Diamond Creek, Victoria 3089');
destinations.push('Hurstbridge, Diamond Creek, Victoria 3089');
destinations.push('Bundoora, Diamond Creek, Victoria 3089');
destinations.push('Doreen, Diamond Creek, Victoria 3089');
destinations.push('Eltham, Diamond Creek, Victoria 3089');
View aumentacoment.php
<?php
function aumentacoment($idtema_foro) {
$this->db->set('comentarios', 'comentarios + 1', FALSE);
$this->db->where('idtema_foro', $idtema_foro);
return $this->db->update('tema_foros', $data);
}
View insertacomenta.php
<?php
public function insertacomenta($idtema_foro = NULL) {
if (is_null($idtema_foro)) {
// podes mostrar una página de error
show_error('ID Tema no disponible');
// o podes hacer un redirect
$this->session->set_flashdata('error', 'ID Tema no disponible');
redirect('foros');
}
@everdaniel
everdaniel / import.sh
Created Mar 6, 2014
Bash script example for data import
View import.sh
#!/bin/bash
WORKDIR="$( cd "$( dirname "$0" )" && pwd )"
DB_USER="user"
DB_PASSWORD="pasword"
DB_NAME="database_name"
FILE_PROC="$WORKDIR/processing"
FILE_COMP="$WORKDIR/completed"
if [ -e $FILE_PROC ]
then
View gist:8967762
{{ streams:cycle stream="sliders" }}
{{ entries }}
{{ if page:slug == stream_field:slug }}
Text goes here if same id's
{{ endif }}
{{/entries}}
{{ /streams:cycle }}
View jsonapi.md

JSON API

There are two JSON API styles:

  • The ID Style
  • The URL Style

The ID style is the easiest to get started with, but requires that your clients be able to guess the URLs for related documents. It also locks your API into a particular URL structure, which may become a problem as your API grows.

The URL style requires less guessing on the client side, and makes clients more resilient to API changes, but is trickier to use with relationships and compound documents.