Skip to content

Instantly share code, notes, and snippets.

View flashvnn's full-sized avatar

Huynh Khac Thao flashvnn

View GitHub Profile
@vilkoz
vilkoz / setup_http_server_on_android_with_termux.md
Last active June 17, 2024 04:33
setup http server on android with termux

Setting up http server on android with termux

Setting SSH server

To be able to make all procedures without pain you should have physical keyboard or just install ssh server and connect to your device shell from computer.

Folow this guide to setup ssh server.

Installing needed stuff

@cb109
cb109 / breakpoint.js
Last active May 5, 2022 15:40
Vue Breakpoints Mixin (also available via npm: https://www.npmjs.com/package/vue-md-breakpoint)
// Now officially integrated into Vuetify:
//
// https://github.com/vuetifyjs/vuetify/blob/master/src/components/VApp/mixins/app-breakpoint.js
// https://github.com/vuetifyjs/vuetify/blob/master/src/components/VApp/mixins/app-breakpoint.spec.js
/**
* A Vue mixin to get the current width/height and the associated breakpoint.
*
* Useful to e.g. adapt the user interface from inside a Vue component
* as opposed to using CSS classes. The breakpoint pixel values and
@crittermike
crittermike / import.php
Last active August 11, 2023 10:39
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
// Assumes $data has the data you want to import for this config.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');
@harish2704
harish2704 / lodash.get.js
Last active June 3, 2023 23:41
Simple lodash.get function in javascript
/* Implementation of lodash.get function */
function getProp( object, keys, defaultVal ){
keys = Array.isArray( keys )? keys : keys.split('.');
object = object[keys[0]];
if( object && keys.length>1 ){
return getProp( object, keys.slice(1) );
}
return object === undefined? defaultVal : object;
}
@rid00z
rid00z / AsyncHelper.cs
Created September 19, 2015 03:11
This code can be used to task a async task and run it without the async part.
public static class AsyncHelper
{
private static readonly TaskFactory _myTaskFactory = new
TaskFactory(CancellationToken.None,
TaskCreationOptions.None,
TaskContinuationOptions.None,
TaskScheduler.Default);
public static TResult RunSync<TResult>(Func<Task<TResult>> func)
{
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Markup;
using Cirrious.CrossCore.Wpf.Converters;
using Cirrious.MvvmCross.Localization;
@geirsagberg
geirsagberg / StoryBoardContainer.cs
Last active November 19, 2015 12:02
MvvmCross load views from Storyboards using a custom attribute
public class StoryBoardContainer : MvxTouchViewsContainer
{
protected override IMvxTouchView CreateViewOfType(Type viewType, MvxViewModelRequest request)
{
var storyboardAttribute = viewType.GetCustomAttribute<FromStoryboardAttribute>();
if (storyboardAttribute != null) {
var storyboard = UIStoryboard.FromName(storyboardAttribute.StoryboardName ?? viewType.Name, null);
var viewController = storyboard.InstantiateViewController(viewType.Name);
return (IMvxTouchView) viewController;
}
@MitchMilam
MitchMilam / ListViewAlternatingBackgroundColors.cs
Last active August 30, 2023 20:34
Alternating background colors in a Xamarin.Forms ListView
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace XamarinFormsDeepDive
{
class ListViewDemo : ContentPage
{
class Person
{
@maximilianschmitt
maximilianschmitt / jobs.js
Created September 3, 2014 23:47
Automated MySQL backups to S3 with node.js
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
@jameymcelveen
jameymcelveen / StyledRenderer_iOS.cs
Last active August 29, 2015 14:05
Pixate iOS helper for Xamarin.Forms. This class copies style info from Xamarin.Forms elements into the underlying native component.
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using YourProject.iOS;
using System.ComponentModel;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using PixateFreestyleLib;
using Common;