Skip to content

Instantly share code, notes, and snippets.

@adeel
adeel / push-notifications.clj
Created July 26, 2011 01:03
Example of sending Apple push notifications with Clojure.
; Depends on [com.notnoop.apns/apns "0.1.6"].
(:import ('com.notnoop.apns APNS))
(defn send-push-notification [device-token message]
(let [service (.build (.withSandboxDestination
(.withCert (APNS/newService) "resources/apns-dev-cert.p12" "password")))
payload (.build (.alertBody (APNS/newPayload) message))]
(.push service device-token payload)))
@mattmcd
mattmcd / Hello.g4
Last active April 19, 2024 08:04
Simple ANTLR4 grammar example
// define a grammar called Hello
grammar Hello;
r : 'hello' ID;
ID : [a-z]+ ;
WS : [ \t\r\n]+ -> skip ;
@ftvs
ftvs / CameraShake.cs
Last active May 17, 2024 12:21
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
@dhlavaty
dhlavaty / downloadCSV.cs
Last active June 10, 2023 14:08
Download CSV file from Google Spreadsheet (Google Drive) using minimum c# code
using System;
using System.Net;
namespace ConsoleApplication1
{
class Program
{
public class WebClientEx : WebClient
{
public WebClientEx(CookieContainer container)
@Metaxal
Metaxal / logging.rkt
Last active September 10, 2023 09:52
Simple usage of Racket's logging facility
#lang racket/base
; One way to define a logger
(define lg (make-logger 'my-logger))
; Define a receiver for this logger, along with a log level
(define rc (make-log-receiver lg 'error)) ; also try with 'debug
; Another way to define a logger, with additional forms
(define-logger lg2)
(define rc2 (make-log-receiver lg2-logger 'debug))
@avescodes
avescodes / gist:e5d1acbb007f47655508
Created August 18, 2014 18:42
Great little snippet for using Postgres enum types inside clojure.java.jdbc
(defn keyword->pg-enum
"Convert a keyword value into an enum-compatible object."
[enum-type kw]
(doto (org.postgresql.util.PGobject.)
(.setType enum-type)
(.setValue (name kw))))
(def ->status
"Convert a keyword status into a something_status enum object"
(partial keyword->pg-enum "something_status"))
@mohamed
mohamed / build-gn.sh
Last active September 23, 2022 06:25
Build Google gn build tool standalone
#!/usr/bin/env sh
set -euv
# Updated on April 2019 to reflect changes in GN
# See:
# https://github.com/ninja-build/ninja
# https://gn.googlesource.com/gn/
# We need a recent git

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"
# Suppose we already have LXD, and already add the default image repo as images:
# 1. Start a new Trusty LXC container
host:~$ lxc launch images:ubuntu/trusty/amd64 cuda-trusty
# 2. Download and install CUDA on *both* host & LXC container, from https://developer.nvidia.com/cuda-downloads
# Note that host and container have to have *exactly* the same driver version
# 3. Add necessary Nvidia devices to LXC container
host:~$ lxc config device add cuda-trusty nvidia0 unix-char path=/dev/nvidia0
host:~$ lxc config device add cuda-trusty nvidiactl unix-char path=/dev/nvidiactl
@MattRix
MattRix / UnityEditorIcons.txt
Last active April 26, 2024 18:52
A list of all the built-in EdtiorGUI icons in Unity. Use EditorGUIUtility.IconContent([icon name]) to access them.
ScriptableObject Icon
_Popup
_Help
Clipboard
SocialNetworks.UDNOpen
SocialNetworks.Tweet
SocialNetworks.FacebookShare
SocialNetworks.LinkedInShare
SocialNetworks.UDNLogo
animationvisibilitytoggleoff