Skip to content

Instantly share code, notes, and snippets.

@cmpute
cmpute / PinGoogleDriveFS.ps1
Last active September 23, 2024 06:59
Pin Google Drive File Stream to Explorer Sidebar
# This script only works when Google Drive is mounted at G:\
# Change the encoding to UTF-8-BOM before executing this script
# To run this file: powershell -noprofile -executionpolicy bypass -file ./PinGoogleDriveFS.ps1 [add/remove]
# Settings
$ErrorActionPreference = "Stop"
$clsid = "{81539FE6-33C7-4CE7-90C7-1C7B8F2F2D41}" # CLSID for personal drive namespace
$clsid_i = "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" # CLSID for personal drive instance
$clsid_g = "{FB9411E2-c3F8-4004-BA95-47D459C219D1}" # CLSID for shared drive namespace
$clsid_g_i = "{1A223FF4-D08D-4B38-A051-5D2391FE655C}" # CLSID for shared drive instance
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var styl = require('gulp-styl');
var refresh = require('gulp-livereload');
var lr = require('tiny-lr');
var server = lr();
var paths = {
js: 'src/**/*.js',
@brainded
brainded / JsonExtensions.cs
Last active September 16, 2018 17:18
Code snippet to make a ToJson extension method for objects in C#. Relies on NewtonSoft.Json Nuget.
public static class ObjectExtensions
{
/// <summary>
/// The string representation of null.
/// </summary>
private static readonly string Null = "null";
/// <summary>
/// The string representation of exception.
/// </summary>
@bgrins
bgrins / Log-.md
Last active July 11, 2024 13:40
Prevent errors on console methods when no console present and expose a global 'log' function.

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@p1nox
p1nox / postgresql_configuration_on_ubuntu_for_rails.md
Last active July 20, 2024 11:55
PostgreSQL configuration without password on Ubuntu for Rails

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
# Apart from the basic niceties of being able to leave off
# parens in clear calls...
print 10
alert "Hello #{name}"
# ... the reason why they're important to have in CoffeeScript
# is because it allows our "block" syntax (single function body
@PetrKaleta
PetrKaleta / gist:1527710
Created December 28, 2011 11:57
Simple OOP pattern
log = (o) -> console.log o
# -------------- CLASS DEFINITIONS -------------
# Private methods are starting with underscore, but this is just for better readability
class SimpleOOPPattern
@classProperty: 'le class property'
@classMethod: ->
'le class method'
publicProperty: 'le public property'
@mythz
mythz / RpcVsMessages.md
Created November 22, 2011 18:02
Difference between an RPC-chatty and message-based API

Difference between an RPC-chatty and message-based API

	public interface IService
	{
	  Customer GetCustomerById(int id);
	  Customer[] GetCustomerByIds(int[] id);
	  Customer GetCustomerByUserName(string userName);
	  Customer[] GetCustomerByUserNames(string[] userNames);
 Customer GetCustomerByEmail(string email);
@esamattis
esamattis / namespace.coffee
Last active January 29, 2016 13:29
Simple namespace tool
# Namespace tool for accessing our namespace
#
# Usage:
# bar = NS "PWB.foo.bar"
#
# Idea from Javascript Patterns by Stoyan Stefanov
#
window.NS = (nsString) ->
parent = window
for ns in nsString.split "."
@jimmycuadra
jimmycuadra / wat_do.coffee
Created September 14, 2011 04:39
Syntax question for CoffeeScript
# Given a function that accepts a function followed by a non-function argument...
foo = (callback, name) ->
console.log "Calling callback #{name}..."
callback()
# you end up with a line starting with
# a comma which just feels wrong...
foo ->
console.log "Callback called!"
, "bar"