Skip to content

Instantly share code, notes, and snippets.

View AndiSHFR's full-sized avatar
💭
Designing and Coding...

Andreas Schaefer AndiSHFR

💭
Designing and Coding...
View GitHub Profile
@tunnckoCore
tunnckoCore / gist:0b978d2531b1135be9cf
Last active April 15, 2017 09:13 — forked from muhqu/gist:4003563
PHP Mustache-like Template Engine (preg_replace_callback)
<?php
class Template {
function __construct($code, $escape = null) {
$this->code = $code;
$this->preparsed = null;
$this->escape = $escape;
}
@russgray
russgray / marshal-variable-length-array.cs
Created September 29, 2014 16:20
Marshalling a variable-length array from unmanaged code in C#
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace DnsMarshallingTest
{
#region Data structures
[Flags]
internal enum DnsRecordType : ushort
@wendlers
wendlers / smartplug.py
Last active October 16, 2023 21:41
Simple library/command-line-utility to control a EDIMAX Smart Plug Switch (SP-1101W) from Python
##
# The MIT License (MIT)
#
# Copyright (c) 2014 Stefan Wendler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@hjmjohnson
hjmjohnson / CreateGitInspector.sh
Created May 9, 2014 18:01
Create git based statistics script for different projects
#!/bin/sh
# Need more modern version of git than is provided by default
export PATH=/scratch/git-build/bin:${PATH}
SOURCE_BASE_DIR=/scratch
if [ ! -d ${SOURCE_BASE_DIR}/gitinspector ]; then
git clone https://code.google.com/p/gitinspector/ ${SOURCE_BASE_DIR}/gitinspector
@JeffreyWay
JeffreyWay / laravel.js
Last active October 9, 2024 03:43
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@faisalman
faisalman / baseConverter.js
Last active January 11, 2023 14:43
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <[email protected]>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@AvnerCohen
AvnerCohen / npm-cheat-sheet.md
Last active August 28, 2025 08:29
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

List of less common (however useful) NPM commands

Prepand ./bin to your $PATH

Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@briantist
briantist / InstallWindowsManagementFramework.vbs
Last active April 3, 2020 15:42
Install Windows Management Framework core package
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
Set toDL = CreateObject("Microsoft.Update.UpdateColl")
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
For kbidindex = 0 to update.KBArticleIDs.Count-1
@marcusti
marcusti / wuala-git.sh
Created September 9, 2012 07:49
working with a private git repo in Wuala
# create a new bare git repository
cd ~/WualaDrive/username/repos
mkdir project.git
cd project.git
git init --bare
# clone
cd ~/src
git clone ~/WualaDrive/username/repos/project.git/
cd project.git
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: