Skip to content

Instantly share code, notes, and snippets.

❤️
Enamorao

Dvid Silva dvidsilva

❤️
Enamorao
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
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
# http://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
# plus some post-processing to fix invalid entries, remove duplicates, etc.
#
# The content is available under the
# "Creative Commons Attribution-ShareAlike License"
# http://creativecommons.org/licenses/by-sa/3.0/
abandonned->abandoned
View response sample
{
"provider": "ddg",
"query": "cat pircures",
"type": "images",
"results": [
{
"title": "",
"description": "",
"media": {
"url": "gato.png",
@dvidsilva
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)->
if attrs.map
re = /@(-?\d+\.?\d*,-?\d+\.?\d*),([\d]{1,2})z/gi
url = ''
attrs.map.replace re, (match, lat, z)->
z = z || 10
@dvidsilva
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
<?php
<?php
Yii::app()->clientScript->registerScript('settings-script', <<<EOD
FB.Event.subscribe('edge.create', function(response) {
alert('You liked the URL: ' + response);
@dvidsilva
dvidsilva / .vimrc.bundles.local
Created Mar 26, 2014
I use https://github.com/square/maximum-awesome 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
#!/bin/bash
COUNTER=0
while [ $COUNTER -lt 200 ]; do
curl "https://connectapi.telescope.tv/vote?apiKey=nascallstar2014&deviceType=web&timestamp=1397365183350&action_type=vote&country=US&state=CA&doubleVote=false&sprintCustomer=O&insiderEmailOptin=true&smsOptin=false&emailOptin=true&email=none"%"40dispostable.com&v=A12" -H "Origin: http://e1.votenow.tv" -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: http://e1.votenow.tv/?app=web&ref=http"%"3A"%"2F"%"2Fwww.nascar.com"%"2FSprintFanVote.html" -H "Connection: keep-alive" --data "Authorization=kZVndoQjJx8hs0lj8lf6dW2rKEM"%"3D" --compressed
echo the counter is $COUNTER
let COUNTER=COUNTER+1
sleep 1
done
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.
http://www.usatoday.com/story/news/world/2014/04/13/forest-fire-chile-homes/7664531/
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](http://www.techo.org/en/) 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
dvidsilva / Markdown Reference
Created May 29, 2014
Short reference and introduction to markdown. Taken and expanded from https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
View Markdown Reference
This is intended as a quick reference and showcase. For more complete info, see [John Gruber's original spec](http://daringfireball.net/projects/markdown/).
PLEASE DO NOT EDIT THIS PAGE! You can play around with Markdown on our [live demo page](http://www.markdown-here.com/livedemo.html).
##### Table of Contents
[Headers](#headers)
[Emphasis](#emphasis)
[Lists](#lists)
[Links](#links)
@dvidsilva
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
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.