Skip to content

Instantly share code, notes, and snippets.

View dflima's full-sized avatar
📱
developing stuff

Danilo dflima

📱
developing stuff
View GitHub Profile
@dflima
dflima / download.asp
Created November 12, 2012 19:21
Simple download script with asp
<%
On Error Resume Next
downloadPath = <<path>>
fileName = <<name>>
fileExt = <<extension>>
varTo = Server.MapPath(downloadPath) & "\" & fileName & fileExt
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
@dflima
dflima / ConvertIntToDatetime.sql
Created November 27, 2012 11:30
Convert int to datetime
-- Convert int to datetime with this script.
-- If anyone has a better or a more beautiful method, please, feel free to fork and change it. :)
declare @i as int
select @i = 20121029 --aaaammdd
select convert(datetime, convert(char(8), @i))
@dflima
dflima / conf.asp
Created December 28, 2012 17:03
A simple command to set the region configurations (such as date formats) to the country where the developer is coding.
<%
' Command to set the region configurations to
' any country you want
' 1046: Brazil
' 1033: EUA
Session.LCID = 1046
%>
@dflima
dflima / app.php
Created December 28, 2012 18:55
Dynamic routing on silex
<?php
require_once __DIR__.'/../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = new Silex\Application();
// Twig
$app->register(new Silex\Provider\TwigServiceProvider(), array(
@dflima
dflima / gist:4626761
Created January 24, 2013 19:28
Sublime Text snippet for var_dump() any variables.
<snippet>
<content><![CDATA[
echo var_dump(${1:$SELECTION});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>vdump</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>var_dump() any variable</description>
Option Explicit
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Integer) As Integer
Private Sub Form_GotFocus()
Timer1.Enabled = False
End Sub
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then
@dflima
dflima / canvas.html
Created March 13, 2013 15:04
Script for drawing in the canvas with mouse clicks.
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var clicks = 0;
var lastClick = [0, 0];
var canvas = document.getElementById('exemploCanvas');
canvas.addEventListener('click', draw, false);
@dflima
dflima / index.html
Last active December 15, 2015 09:39
to-do list
<!--
From: CodeAcademy.com
Author: Eric Weinstein
Link: http://www.codecademy.com/pt/ericweinstein
-->
<!DOCTYPE html>
<html>
<head>
<title>To Do</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
@dflima
dflima / DragonSlayer.js
Last active December 15, 2015 11:58
DragonSlayer game
var slaying = true;
// A bit of new math magic to calculate the odds
// of hitting the dragon.
var youHit = Math.floor(Math.random() * 2);
var dragonHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;
var life = 10;
var dragonLife = 10;
@dflima
dflima / teste.php
Created April 18, 2013 14:05
teste.php
<?php
$file = 'fake.in.txt';
if (!file_exists($file)) {
echo "O arquivo {$file} não existe.";
exit;
}
$handle = fopen($file, 'r');