-
Single-line comments are started with
//
. Multi-line comments are started with/*
and ended with*/
. -
C# uses braces (
{
and}
) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,
This file contains 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
function mb_trim( $str ) { | |
return mb_ereg_replace( | |
'^[[:space:]]*([\s\S]*?)[[:space:]]*$', '\1', $str ); | |
} |
This file contains 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
#!/usr/bin/env python2.6 | |
import sys, urllib2, urllib, time, threading, signal | |
sys.path.append('support/lib') | |
import settings | |
from settings import logging | |
from lib import taskqueue |
This file contains 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 datetime | |
# requires python-dateutil (http://labix.org/python-dateutil) | |
from dateutil.relativedelta import relativedelta | |
def get_month_day_range(date): | |
""" | |
For a date 'date' returns the start and end date for the month of 'date'. | |
Month with 31 days: |
This file contains 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
data_uri = open("sample.png", "rb").read().encode("base64").replace("\n", "") | |
# HTML Image Element | |
img_tag = '<img alt="" src="data:image/png;base64,{0}">'.format(data_uri) | |
print img_tag | |
# CSS Background Image | |
css = 'background-image: url(data:image/png;base64,{0});'.format(data_uri) | |
print css |
This file contains 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
1ª Criar um grupo de discussão; (Sugestão: Google Groups) | |
2ª Divulgar o grupo para o pessoal da sua região nas redes socias que você participa; | |
(Dica: Divulgação no Twitter é essencial) | |
3ª Fazer um spam para todos os seus contatos da área da sua região convidando para o grupo; | |
4ª Se você não for muito influente nas redes sociais ou não tiver muitos contatos, | |
solicitar para alguém que tenha ajudar na divulgação do grupo; | |
(Dica: O que vale nesse momento é fazer bastante barulho) |
This file contains 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 validEmail($email){ | |
// Check the formatting is correct | |
if(filter_var($email, FILTER_VALIDATE_EMAIL) === false){ | |
return FALSE; | |
} | |
// Next check the domain is real. | |
$domain = explode("@", $email, 2); | |
return checkdnsrr($domain[1]); // returns TRUE/FALSE; |
This file contains 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 redis | |
import time | |
import random | |
def load_file(fp, fpKey, r, expiry): | |
with open(fp, "rb") as f: | |
data = f.read() | |
p = r.pipeline() | |
p.set(fpKey, data) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This file contains 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
public class Java { | |
public static void main(String[] args) { | |
int count = 0; | |
for(int i=0; i<1000; i++){ | |
count += i; | |
} | |
System.out.println(count); // corrigido conforme comentario | |
} | |
} |
OlderNewer