Skip to content

Instantly share code, notes, and snippets.

@rev087
rev087 / en.json
Last active June 16, 2016 04:40
Angular 2 i18n module idea
{
"login-with": "Login with {r0}",
"try-without-acc": "Try without an account",
"new-notifications": {
"string": "You have {p0}",
"plural": {
"p0": { "zero": "no notifications", "one": "one notification", "other": "# notifications"}
}
},
"found-x-in-nth-cat": {
@rev087
rev087 / gist:079923df0d4105397740
Last active August 29, 2015 14:22
Procedural DNA Double Helix 3D model using Forge
using UnityEngine;
using Forge;
using Forge.Primitives;
using Forge.Filters;
public class DNADoubleHelix : ProceduralAsset {
private float Radius = 0.04f;
private float Offset = 0.4f;
@rev087
rev087 / Info.plist
Created May 1, 2015 01:33
Safari extension to display viewport width as a toolbar
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Author</key>
<string>Bruno Daniel</string>
<key>Builder Version</key>
<string>10600.5.17</string>
<key>CFBundleDisplayName</key>
<string>Viewport Width</string>
function find_git_branch {
local dir=. head
until [ "$dir" -ef / ]; do
if [ -f "$dir/.git/HEAD" ]; then
head=$(< "$dir/.git/HEAD")
if [[ $head == ref:\ refs/heads/* ]]; then
git_branch="${head#*/*/}"
elif [[ $head != '' ]]; then
git_branch='(detached)'
else
@rev087
rev087 / redsearch.sh
Created May 27, 2014 17:19
Command-line reddit search via jq
# Search reddit for a string
redsearch() {
curl "http://www.reddit.com/search.json?q=$1" | jq '[.data.children[].data | {created_utc, permalink, num_comments, ups, author, subreddit, url, title} | select(.title | contains("'$1'"))] | sort_by(.created_utc)'
}
@rev087
rev087 / gulpfile.js
Last active September 29, 2017 14:59
Gulp task to bump semver
// This gulpfile adds three tasks to bump the semver release: bump:major, bump:minor, bump:patch.
// First, it checks if the git repository is clean, and fails with an alert otherwise, then:
// - Update manifests (in this example, package.json and Info.plist)
// - Add manifests to the git stage
// - Commit changes in the manifests with the message "Prepare for vX.Y.Z"
// - Tag the release
// All that is left for the user to do is push the commit/tag to the remote repo with `git push --tags`
var gulp = require('gulp');
var semver = require('semver');
@rev087
rev087 / fontprep.sh
Last active December 14, 2015 03:29
Start the FontPrep server and open it in Google Chrome's app mode
fontprep ()
{
# Move to the server folder
cd /Applications/FontPrep.app/Contents/Resources/fontprep_server
# Start the FontPrep server, fork the process and store it's pid
ruby src/main.rb & pid_server=$!
# Give some time for the server to start, then open the URL in Google Chrome's app mode
sleep 2
@rev087
rev087 / json.js
Created June 29, 2012 16:51
Simple JSON parsing command line tool
#!/usr/local/bin/node
/**
* Example usage:
*
* curl https://api.twitter.com/1/statuses/public_timeline.json | json 2.text
* curl https://api.twitter.com/1/statuses/public_timeline.json | json 0.user
*
*/
<?php
// Prepare the API call
$search_string = urlencode("City of God");
$API_KEY = "<redacted>";
$URL = "http://api.themoviedb.org/2.1/Movie.search/en/xml/{$API_KEY}/{$search_string}";
// Perform the API call
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@rev087
rev087 / style.css
Created October 26, 2011 22:01
Exemplo de LESS
body {
padding-top: 60px;
}
.hero-unit img {
margin: -50px -30px 0px 0px;
float: right;
}
.btn.tiny {
padding: 2px 4px;
font-size: 11px;