Skip to content

Instantly share code, notes, and snippets.

View biapar's full-sized avatar
🙂

Biagio Paruolo biapar

🙂
View GitHub Profile
@robgha01
robgha01 / FileUploadApiController.cs
Created February 6, 2017 14:11 — forked from cssquirrel/FileUploadApiController.cs
Using AngularJS API service and Umbraco API controller to permit users to upload files to the server
// Use whatever namespacing works for your project.
namespace YourSite.Web.Controllers.Api
{
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
@biapar
biapar / gist:2902f4ee8790af18dcd875a0040d8a32
Created December 14, 2016 13:46
An Umbraco partial view that list the last six post from Articulate blog
@inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent>
@using Articulate;
@using Articulate.Models;
@using Umbraco;
@using Umbraco.Web;
@using Umbraco.Core;
@using Umbraco.Core.Models;
@using System.Linq;
@using System;
@{
@mbdavid
mbdavid / Transaction.cs
Last active May 3, 2020 19:39
LiteDB v3 Transaction Syntax Options
// 1
db.BeginTrans();
// ... do stuffs
db.Commit(); // or db.Rollback();
// 2
using(var t = db.BeginTrans()) // where t is LiteTransaction
{
// ... do stuffs
@biapar
biapar / uninstall_vmware.sh
Created September 3, 2016 14:42 — forked from boneskull/uninstall_vmware.sh
completely uninstall vmware on mac
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing \e[1;34m$entry\e[0m... "
sudo rm -rf "$entry" &> /tmp/uninstall-vmware.log
if [[ ! -e "$entry" ]]; then
echo -e "\e[1;32mOK\e[0m"
@DavidVeksler
DavidVeksler / ImportController.cs
Created August 22, 2016 22:12
How FEE digitized and shared 70 years of archives on the Web: an Umbraco case study
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Archive.FEE.Web.Helper.PDFParser;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@alirobe
alirobe / umbraco-filebrowser.cshtml
Last active August 19, 2022 21:49
A simple recursive media folder/file viewer macro for directory browsing in #Umbraco 7+, using Bootstrap 3 for display. Not suitable for >100 files (use a surfacecontroller)
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var mediaId = Model.MacroParameters["mediaId"]; }
@helper DisplayFolder(dynamic folder, bool collapsed) {
var items = folder.Children().OrderBy("DocumentTypeAlias Desc,Name");
if (items.Any()) {
<a class="list-group-item" role="button" aria-expanded="false" data-toggle="collapse" href="#macro-mediaList-folder-@folder.Id">
<i class="glyphicon glyphicon-folder-open"></i> &nbsp; @folder.Name
</a>
<div class="list-group @(collapsed?"collapse":"collapse in") well well-sm" id="macro-mediaList-folder-@folder.Id">
@foreach(var item in items) {
@biapar
biapar / gist:18a9c4d77702743dbca4
Created December 17, 2015 14:16 — forked from grandmanitou/gist:8863248
Place multiple markers with infowindow on Google Maps API v3, use external links to trigger click and center map on desired location.
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?language=fra&amp;sensor=false"></script>
<script type="text/javascript">
var map;
var Markers = {};
var infowindow;
var locations = [
[
'Samsung Store Madeleine',
'<strong>Samsung Store Madeleine</strong><p>5 Boulevard Malesherbes, 75008 Paris<br>10h – 20h</p>',
48.8701925,
@bitkidd
bitkidd / deleting_tons_of_files_in_linux.md
Last active August 14, 2018 13:59
Deleting tons of files in Linux (Argument list too long)

If you’re trying to delete a very large number of files at one time (I deleted a directory with 485,000+ today), you will probably run into this error:

/bin/rm: Argument list too long.

The problem is that when you type something like “rm -rf ”, the “” is replaced with a list of every matching file, like “rm -rf file1 file2 file3 file4” and so on. There is a reletively small buffer of memory allocated to storing this list of arguments and if it is filled up, the shell will not execute the program. To get around this problem, a lot of people will use the find command to find every file and pass them one-by-one to the “rm” command like this:

find . -type f -exec rm -v {} \;

My problem is that I needed to delete 500,000 files and it was taking way too long.

@naepalm
naepalm / FAQListing.cshtml
Last active October 8, 2019 23:45
An example of different ways to code the Umbraco FAQ Package's content.
@using FAQ
@inherits UmbracoTemplatePage
@{
Layout = null;
}
<h1>@Model.Content.Name</h1>
<h2>Render All FAQ Items</h2>
@DavidVeksler
DavidVeksler / ForgotPassword.cshtml
Created September 6, 2015 11:22
Umbraco 7: reset password for user and forgot password implementation
@using FEE.Domain
@inherits UmbracoTemplatePage
@{
Layout = "FEEMaster.cshtml";
var featuredImage = CoverImageProvider.GetCoverImageOrDefault(CurrentPage.featuredImage);
}
@section bodyClass {subpage}
@*TODO maybe implement:https://github.com/warrenbuckley/CWS-Umbraco-Standard-Membership/blob/master/CWSUmbracoStandardMembership/Views/AuthSurface/ResetPassword.cshtml