This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function validate_email($email) { | |
if (filter_var($email, FILTER_VALIDATE_EMAIL)) | |
return true; | |
return false; | |
} | |
var_dump(validate_email("me@example.com")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_json($string) | |
{ | |
json_decode($string); | |
return (json_last_error() == JSON_ERROR_NONE); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.disable = function(){ | |
return this.each(function(){ | |
if(typeof this.disabled != "undefined") this.disabled=true | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin, datetime | |
class InsertTimeCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
date_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') | |
for r in self.view.sel(): | |
self.view.replace(edit, r, date_time) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = 'fake.in.txt'; | |
if (!file_exists($file)) { | |
echo "O arquivo {$file} não existe."; | |
exit; | |
} | |
$handle = fopen($file, 'r'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
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"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |