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
View README.md
View gist:b213ed0ec07ae74b5c9c
window.addEventListener("orientationchange", handleOrientation, true);
function handleOrientation(){
if (Math.abs(window.orientation) == 90) {
angular.element(document.querySelector('#imagenBackground')).attr("src","img/background-landscape.png");
angular.element(document.querySelector('#imagen-Background')).css("width","35%");
} else {
angular.element(document.querySelector('#imagenBackground')).attr("src","img/background-portrait.png");
angular.element(document.querySelector('#imagen-Background')).css("width","45%");
}
View es6
const length = ([first, ...rest]) =>
first === undefined
? 0
: 1 + length(rest);
const flatten = ([first, ...rest]) => {
if (first === undefined) {
return [];
}
@dvidsilva
dvidsilva / imgur.rb
Created Dec 9, 2014
Imgur API wrapper for Ruby
View imgur.rb
# require 'imgur/version'
require 'httparty'
require 'net/http'
module Imgur
HTML_PATH = 'https://imgur.com/'
API_PATH = 'https://api.imgur.com/3/'
UPLOAD_PATH = 'upload'
IMAGE_PATH = 'image/'
View designer.html
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@dvidsilva
dvidsilva / XHR request
Created Oct 23, 2014
Creating an XHR request with JavaScript
View XHR request
function ajax() {
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 ) {
if(xmlhttp.status == 200){
document.getElementById("response").innerHTML = xmlhttp.responseText;
}
@dvidsilva
dvidsilva / promise-sample.js
Created Aug 29, 2014
function promises thingie angularjs
View promise-sample.js
f.getCallHistory = function(){
var request = $http({
data: {
method: 'doctors.get_member_history',
id: f.id,
params: {
call_id : f.call_id
},
jsonrpc: '2.0'
},
View angular-folder-structure.md

/

  • /_files <-- random stuff
  • /build <-- publicly accessible ignore the contents of this in .gitignore
  • /assets
  • /less
  • /images
  • /fonts
  • /vendor
View onename...
Verifying that +dvidsilva is my Bitcoin username. You can send me #bitcoin here: https://onename.io/dvidsilva
View keybase.md

Keybase proof

I hereby claim:

  • I am dvidsilva on github.
  • I am dvidsilva (https://keybase.io/dvidsilva) on keybase.
  • I have a public key whose fingerprint is 4408 194C 5E0E DC7E ED83 830B ECF6 B6A9 5D87 FD19

To claim this, I am signing this object:

You can’t perform that action at this time.