Skip to content

Instantly share code, notes, and snippets.

View biapar's full-sized avatar
🙂

Biagio Paruolo biapar

🙂
View GitHub Profile
@tbranyen
tbranyen / _usage.md
Last active April 19, 2024 12:24
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
@ErisDS
ErisDS / examples.md
Last active May 2, 2024 08:23
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.
@KevinJump
KevinJump / documentlist.cshtml
Last active February 19, 2020 16:19
Umbraco Macro file to render a list of documents on a page
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Umbraco.Web.Models
@{
var folders = Model.GetParameterValue<string>("mediaFolder", "")
.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
var subFolders = Model.GetParameterValue<bool>("subFolders", true);
var selection = Umbraco.TypedMedia(folders).Where(x => x != null);
@biapar
biapar / InitArcheType
Last active October 18, 2015 11:03
How to read and write to Umbraco Archetype
var archetypeValueAsString = member.GetValue<string>("figli");
var member = Services.MemberService.GetById(user.Id);
if (archetypeValueAsString == null)
{
//var archetype2 = JsonConvert.DeserializeObject<ArchetypeModel>(archetypeValueAsString);
ArchetypeModel a = new ArchetypeModel();
@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
@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>
@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.

@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,
@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) {