Skip to content

Instantly share code, notes, and snippets.

@dragouf
dragouf / swift String extension
Last active April 21, 2016 07:41
swift String extension
extension String
{
subscript (i: Int) -> Character
{
return self[advance(self.startIndex, i)]
}
subscript (i: Int) -> String
{
return String(self[i] as Character)
@dragouf
dragouf / gist:4c1e0c8fcbc911910beb
Created August 17, 2015 11:47
List jQuery events
function listEvents(name) {
var cache = jQuery.cache,
exp = jQuery.expando,
key, cacheObj, events, event, namespace, handlers = [],
eventsObjects, eventObject, i, l;
for (key in cache) {
cacheObj = cache[key];
if ("events" in cacheObj) {
events = cacheObj.events;
*Updated for 3.4.2*
Turn off ALL Ads/Featured Content/Bundle Crap in Utorrent/Bittorrent:
Options > Preferences > Advanced...
Turn ALL settings to false:
bt.enable_pulse
distributed_share.enable
gui.show_notorrents_node
offers.left_rail_offer_enabled
git config --global alias.logp 'log -n 40 --graph --decorate --date=relative --pretty=format:"%Cgreen%h %C(bold blue)%ad %C(yellow)%an: %Creset%s -%C(bold cyan)%d%Creset"'
string resxFile = @"..\..\Resource1.resx"; // relative directory to the executable file
using (ResXResourceReader resxReader = new ResXResourceReader(resxFile))
{
resxReader.UseResXDataNodes = true;
foreach (DictionaryEntry entry in resxReader)
{
var node = (ResXDataNode)entry.Value;
var value = node.GetValue((ITypeResolutionService)null);
var comment = node.Comment;
var key = entry.Key;
{"swagger":"2.0","info":{"version":"v1","title":"Vulog Carsharing FO API"},"basePath":"/api-fo/final","paths":{"/v1/availableVehicles":{"get":{"tags":["AvailableVehicles"],"summary":"All available vehicles.","description":"Get the list of all available vehicles, it can be a lot of data.","operationId":"V{versionAvailableVehiclesGet","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"An array of available vehicles","schema":{"type":"array","items":{"$ref":"#/definitions/AvailableVehicle"}}},"204":{"description":"No available vehicle found"}}}},"/v1/device/notification":{"post":{"tags":["Device"],"summary":"Susbcribe a phone device for push notifications","operationId":"V{versionDeviceNotificationPost","consumes":["application/json","text/json","application/json-patch+json"],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"subscription","in":"body","description":"the subscription details","required":false,"sche
@dragouf
dragouf / amazon-dash.sh
Last active October 29, 2017 17:29
bash amazon dash handler
#!/bin/bash
MAC_ON="18:74:2e:26:95:d9"
MAC_PAMPERS="b4:7c:9c:bd:eb:f0"
function onClick {
#code to be ran on click
#node ./mqtt.js
#mosquitto_pub -h 192.168.1.12 -t cmnd/chevet2/power -m TOGGLE
found_mac=$2
if [[ $found_mac == *"$MAC_ON"* ]]; then
@dragouf
dragouf / amazondash.service
Created October 29, 2017 17:53
amazon dash handler as a service
[Unit]
Description = Handle amazon dash button click
After = network.target
[Service]
ExecStart = /mnt/dietpi_userdata/amazon-dash.sh > /dev/null
[Install]
WantedBy = multi-user.target
# to put inside /etc/systemd/system/
@dragouf
dragouf / machine.js
Last active February 4, 2021 03:43
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions