Skip to content

Instantly share code, notes, and snippets.

@drodriguez
drodriguez / test.mm
Created Dec 22, 2010
Objective-C++ NSString wrapper example
View test.mm
// $ g++ -o test -framework Foundation -Wall test.mm
// $ ./test
// The string length is 12
// The string third char value is 108
// The string is Hello World!
#include <iostream>
#import <Foundation/Foundation.h>
class MyCppNSStringWrapper
@viking
viking / raphael-arrow.js
Created Jun 23, 2011
Raphael.js arrow function
View raphael-arrow.js
Raphael.fn.arrow = function(x1, y1, x2, y2, size) {
var angle = Raphael.angle(x1, y1, x2, y2);
var a45 = Raphael.rad(angle-45);
var a45m = Raphael.rad(angle+45);
var a135 = Raphael.rad(angle-135);
var a135m = Raphael.rad(angle+135);
var x1a = x1 + Math.cos(a135) * size;
var y1a = y1 + Math.sin(a135) * size;
var x1b = x1 + Math.cos(a135m) * size;
var y1b = y1 + Math.sin(a135m) * size;
@darktable
darktable / GUIScaler.cs
Created Mar 11, 2012
Unity3D: script to automatically scale gui elements on high dpi devices (like iPhone 4 or iPad 3rd Generation).
View GUIScaler.cs
using UnityEngine;
using System.Collections;
namespace UnityEngine {
/// <summary>
/// Usage:
///
/// (optional) Call GUIScaler.Initialize() in Start(), Awake() or OnEnable() (only needed once)
/// Call GUIScaler.Begin() at the top of your OnGUI() methods
/// Call GUIScaler.End() at the bottom of your OnGUI() methods
@Zoramite
Zoramite / maintenance.sh
Created Mar 14, 2012
Git Maintenance Commands
View maintenance.sh
# Verifies the connectivity and validity of the objects in the database
git fsck —unreachable
# Manage reflog information
git reflog expire —expire=0 —all
# Pack unpacked objects in a repository
git repack -a -d -l
# Prune all unreachable objects from the object database
anonymous
anonymous / GCPluginInstaller.wxs
Created Apr 12, 2012
Example code for creating multiple installer types
View GCPluginInstaller.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="GradeCam Plugin" Language="1033" Version="${FBSTRING_PLUGIN_VERSION}" Manufacturer="${FBSTRING_CompanyName}" UpgradeCode="b0000000-4cf5-51d8-9699-b470daed7c1e">
<Package InstallerVersion="200" Compressed="yes" Description="Installer for the GradeCam Plugin" InstallScope="perUser" />
<Upgrade Id="b0000000-4cf5-51d8-9699-b470daed7c1e">
<UpgradeVersion
Property="OLD_VERSION_FOUND"
Minimum="0.0.1" IncludeMinimum="yes"
Maximum="${FBSTRING_PLUGIN_VERSION}" IncludeMaximum="yes"
@icomefromthenet
icomefromthenet / Vagrantfile
Created Jul 10, 2012
Vagrant setup for cli php dev
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
@cheynewallace
cheynewallace / ExportSchema.ps1
Last active Nov 18, 2020
Export MSSQL schema with PowerShell. This script will export your schema definitions for tables, stored procs, triggers, functions and views to .sql files
View ExportSchema.ps1
# Usage: powershell ExportSchema.ps1 "SERVERNAME" "DATABASE" "C:\<YourOutputPath>"
# Start Script
Set-ExecutionPolicy RemoteSigned
# Set-ExecutionPolicy -ExecutionPolicy:Unrestricted -Scope:LocalMachine
function GenerateDBScript([string]$serverName, [string]$dbname, [string]$scriptpath)
{
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
@staltz
staltz / introrx.md
Last active Nov 23, 2020
The introduction to Reactive Programming you've been missing
View introrx.md
@dmarcato
dmarcato / strip_play_services.gradle
Last active Sep 15, 2020
Gradle task to strip unused packages on Google Play Services library
View strip_play_services.gradle
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
@kachayev
kachayev / concurrency-in-go.md
Last active Nov 18, 2020
Channels Are Not Enough or Why Pipelining Is Not That Easy
View concurrency-in-go.md
You can’t perform that action at this time.