Skip to content

Instantly share code, notes, and snippets.


Dvid Silva dvidsilva

Block or report user

Report or block dvidsilva

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dvidsilva / List of common typos
Created Feb 16, 2014
# This file contains a number of common English typos: andriod->android
View List of common typos
# The remainder of this file contains misspellings from
# plus some post-processing to fix invalid entries, remove duplicates, etc.
# The content is available under the
# "Creative Commons Attribution-ShareAlike License"
View response sample
"provider": "ddg",
"query": "cat pircures",
"type": "images",
"results": [
"title": "",
"description": "",
"media": {
"url": "gato.png",
dvidsilva / angular-google-map-directive
Created Mar 19, 2014
Angular directive to embed google maps in your application
View angular-google-map-directive
#put the map url in a map attribute in the dom element that has this directive.
#it will get the location from the map url and create an iframe
myApp.directive 'gMap', ->
restrict: "EA"
link: (scope, element, attrs)->
re = /@(-?\d+\.?\d*,-?\d+\.?\d*),([\d]{1,2})z/gi
url = '' re, (match, lat, z)->
z = z || 10
dvidsilva / inline js in yii view
Created Mar 24, 2014
example on how to add js in a view
View inline js in yii view
//here view code, mostly HTML with php snippets to insert variables
//block with JS code
Yii::app()->clientScript->registerScript('settings-script', <<<EOD
FB.Event.subscribe('edge.create', function(response) {
alert('You liked the URL: ' + response);
dvidsilva / .vimrc.bundles.local
Created Mar 26, 2014
I use for my vim basic config, this two extra files are the local shorcuts and plugins that i add.
View .vimrc.bundles.local
Bundle 'chriskempson/tomorrow-theme', {'rtp': 'vim/'}
Bundle "xolox/vim-misc"
Bundle "xolox/vim-session"
Bundle "vim-multiple-cursors"
Bundle 'groenewege/vim-less'
Bundle 'kchmck/vim-coffee-script'
View Vote for josh Wise
while [ $COUNTER -lt 200 ]; do
curl ""%"" -H "Origin:" -H "Accept-Encoding: gzip,deflate,sdch" -H "Accept-Language: es,en-US;q=0.8,en;q=0.6,he;q=0.4" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "Referer:"%"3A"%"2F"%""%"2FSprintFanVote.html" -H "Connection: keep-alive" --data "Authorization=kZVndoQjJx8hs0lj8lf6dW2rKEM"%"3D" --compressed
echo the counter is $COUNTER
sleep 1
View Lets help chile
Hey shibes! you might know by now but there was a terrible fire in Chile, that killed some people and destroyed many houses in an area that was already in not great shape.
We've been working a lot in Josh and letting the word out, but we're all about helping others and this is some people that need it.
I'm getting in touch with [Techo]( they have the most experience in the country helping in these situations to find a way to send them money from here.
Any cent helps :) in this cases people can benefit from even the cheapest things, since water sources are hard to get to, diapers for kids, etc.
dvidsilva / Markdown Reference
Created May 29, 2014
Short reference and introduction to markdown. Taken and expanded from
View Markdown Reference
This is intended as a quick reference and showcase. For more complete info, see [John Gruber's original spec](
PLEASE DO NOT EDIT THIS PAGE! You can play around with Markdown on our [live demo page](
##### Table of Contents
dvidsilva / Bubblesort
Last active Aug 29, 2015
Bubble sort in JS
View Bubblesort
var a = [199, 123, 23, 1241, 2412, 123 ,44, 5, 23, 1, 13];
function sortWithBubble(arr)
var swapped;
do {
swapped = false;
for (var i=0; i < arr.length-1; i++) {
if (arr[i] > arr[i+1]) {
var temp = arr[i];
dvidsilva / Check for mobile
Created Aug 11, 2014
check the user agent to see if the browser is ios or android and add a class to the body
View Check for mobile
function isAppleDevice(){
return (
(navigator.userAgent.toLowerCase().indexOf("ipad") > -1) ||
(navigator.userAgent.toLowerCase().indexOf("iphone") > -1) ||
(navigator.userAgent.toLowerCase().indexOf("ipod") > -1)
var isAndroid = navigator.userAgent.toLowerCase().indexOf("android");
var appStoreURL = "";
You can’t perform that action at this time.