Skip to content

Instantly share code, notes, and snippets.

View MarcAlx's full-sized avatar
🌱

MarcAlx MarcAlx

🌱
View GitHub Profile
@chuckwagoncomputing
chuckwagoncomputing / gist:4234127
Last active February 2, 2024 14:25 — forked from matthew-french/gist:4234076
pbcopy ssh public key to your clipboard
#pbcopy < ~/.ssh/id_rsa.pub
#or
cat ~/.ssh/id_rsa.pub | pbcopy
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@demisx
demisx / angularjs-providers-explained.md
Last active May 17, 2024 03:38
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@qizhihere
qizhihere / merge-table.lua
Created July 4, 2015 07:47
merge two tables in lua
function table.merge(t1, t2)
for k,v in ipairs(t2) do
table.insert(t1, v)
end
return t1
end
@fbaiodias
fbaiodias / README.md
Last active July 21, 2021 19:04
GraphQL circular dependencies

Circular dependencies on GraphQL schemas

Problem

Whenever I uncomment the lines on author.js I get the following error:

/Users/xicombd/Code/taskq/taskq-api/node_modules/graphql/jsutils/invariant.js:20
    throw new Error(message);
    ^
@dkudelko
dkudelko / CustomEntryRenderer_Droid.cs
Created March 21, 2016 08:25
remove a default bottom line on android entry Xamarin.Forms
using Mobile.Droid.Renderers;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(Entry), typeof(CustomEntryRenderer_Droid))]
namespace Mobile.Droid.Renderers
{
public class CustomEntryRenderer_Droid : EntryRenderer
{
@anova
anova / Twitter.cs
Created June 8, 2016 04:18
C# twitter application only authentication example (via bearer token)
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
@fernandohu
fernandohu / Reading configuration files before application startup in Angular2 final release.md
Last active May 8, 2023 16:40
Reading configuration files before application startup in Angular2 final release

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

@kubeliv
kubeliv / vibrate.swift
Last active July 1, 2021 14:19
Swift script to consistently vibrate the MacBook touchpad - Updated to macOS 10.13
import AppKit
var i = 1;
while i <= 5000 {
NSHapticFeedbackManager.defaultPerformer.perform(NSHapticFeedbackManager.FeedbackPattern.alignment, performanceTime: NSHapticFeedbackManager.PerformanceTime.now);
i = i + 1
usleep(10000000 / 10000);
}
@steveoh
steveoh / update_symbology.py
Created November 13, 2017 23:47
Update layer symbology with arcpy
import json
import arcpy
def resize_symbol(layer):
if not layer.isFeatureLayer:
return
symbology = json.loads(layer._arc_object.getsymbology())