Skip to content

Instantly share code, notes, and snippets.

View menjaraz's full-sized avatar

Menjanahary menjaraz

View GitHub Profile

Convert an existing project to TypeScript?

Rename files from javascript to typescript

ls *.js -Recurse | foreach{ move-item $_ ($_.FullName.TrimEnd("js") + "ts") }

install grunt-typescript (There are other TypeScript packages out there but I tried this one and it worked)

npm install grunt-typescript --save-dev

//Typescript - One way of creating properties in Typescript
'use strict';
class Animal{
public animalType: string;
constructor(animalType: string){
this.animalType = animalType;
}
}
//compiled javascript
@menjaraz
menjaraz / app.d
Last active August 29, 2015 14:21 — forked from yannick/app.d
import std.stdio;
import vibe.http.client;
import vibe.stream.operations : readAllUTF8;
import vibe.http.common : HTTPMethod;
import vibe.core.concurrency;
import vibe.core.core;
import std.datetime;
shared static Task dbTask;
node_modules
build
*.min.js
(function(artoo) {
// Artoo Spider for http://www.immobiliare.it/info/ufficio-stampa
var scrape = {
iterator: '#wrapTestoStatiche',
data: {
'id': function() {
var id = artoo.$(this).find('.text-align_left a:last-child').attr('href');
if (id) {
id = id.match(/ImmoNews\-(\d+)\.pdf$/);
var urls = ['url', 'url2'];
artoo.ajaxSpider(
function(i) {
return urls[i];
},
{
process: function(data, i) {
var inv = $(data).find('.classname').text();
var url = urls[i];
return [url, inv];
artoo.scrape('.subscriptions .subscription', {
name: function() {
return $.trim($(this).find('.productLink a').text());
},
price: function() {
var match = $(this).find('.priceInformation').text().match(/Current price:\s+\$(\d+\.\d+)/);
return match ? match[1] : '';
},
"interval in months": function() {
var match = $(this).find('.frequency').text().match(/every\s+(?:(\d)\s+)?month/);
<?php
/*
|--------------------------------------------------------------------------
| Sharing Laravel's session and checking authentication
|--------------------------------------------------------------------------
|
| Use the following code in any CMS (WordPress, Joomla, etc), filemanager (CKFinder,
| KCFinder, simogeos's Filemanager, etc), or any other non-Laravel project to boot into
| the Laravel framework, with session support, and check if the user is authenticated.
<?php
class ZipImages
{
private $folder;
private $url;
private $html;
private $fileName;
private $status;