Skip to content

Instantly share code, notes, and snippets.

View AbraaoAlves's full-sized avatar
☀️
stay positive

AbraaoAlves AbraaoAlves

☀️
stay positive
View GitHub Profile
@AbraaoAlves
AbraaoAlves / package.json
Created June 22, 2016 13:03
build [email protected] app package.json sample
{
"scripts": {
"postinstall": "electron-rebuild",
"test": "gulp test",
"compile": "gulp build",
"start": "npm run compile && electron main.js",
"clean": "rimraf ./output",
"clean:osx": "rimraf ./output/osx",
@AbraaoAlves
AbraaoAlves / samples.ts
Created June 17, 2016 18:59
Typescript Polymorphic 'this' types Sample
class A {
data:string;
constructor(self){}
//see 'this' magic
clone():this {
return Object.create(this);//or use lodash or what you want;
}
}
@AbraaoAlves
AbraaoAlves / time.js
Created June 10, 2016 10:51
custom types in #typescript
//enums não são necessarios, types strings não sujam o seu JS
function timeParse(date, format) {
if(format === "unixparse"){
return JSON.stringify({"unixtime": date.getTime()});
}
if(format === "parsetime"){
var summary = {
"hour": date.getHours(),
@AbraaoAlves
AbraaoAlves / createComponent.js
Created June 6, 2016 19:13
Async JS test sample
function criarComponente(name, type) {
var events = {
'onAfterLoad': [],
};
return {
url: '',
load: function () {
@AbraaoAlves
AbraaoAlves / exec
Created May 31, 2016 02:14
Sample typescript watch
# to install dependencies
npm install
# to compile and recompile to changes
npm run build:watch
#Use 'concurrently' when start many watchers in same time, like server+styles+preprocessors
@AbraaoAlves
AbraaoAlves / sample.dart
Created April 19, 2016 16:40
dart code sample
import 'dart:math' as Math;
class Circulo {
int ri;
Circulo(int r){
this.ri = r;
}
calcularArea(int r){
@AbraaoAlves
AbraaoAlves / old.coffeee
Created March 25, 2016 22:55
Programatic strict change data
# Update Neighborhood Name
router.put '/:id', (req, res) ->
Neighborhoods = req.app.components.neighborhoods['neighborhoods.model']
params = {
_id: req.params.id
}
Neighborhoods
@AbraaoAlves
AbraaoAlves / javascript.json
Last active August 29, 2015 14:24
VSCode snippets
{
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
},
"Simple function":{
@AbraaoAlves
AbraaoAlves / exemple.js
Created July 13, 2015 18:24
replace value with regex
var reg = /"IPhone 6": .+;/g;
var str = '{asdasdasd; "IPhone 6": weqweq; "asdasda":"asdasdas"}'
str.match(reg)
//[""IPhone 6": weqweq;"]
var resul = str.match(reg)[0].replace("\"IPhone 6\":", "").replace(";", "")
resul
//" weqweq"
@AbraaoAlves
AbraaoAlves / Calc.py
Created July 10, 2015 21:01
Prova1 Ronaldo
__author__ = 'Abraao Alves'
import sys
class Calc():
def __init__(self, num1, num2):
self.num1 = num1
self.num2 = num2