Skip to content

Instantly share code, notes, and snippets.

View capripot's full-sized avatar
💭

Ronan capripot

💭
View GitHub Profile
@madrobby
madrobby / date.rb
Created February 15, 2013 17:37
`Date.parse` with some extra leeway to handle user input errors. Handles things like `2013-02-31` (parses it as `2013-02-29`) and handles things in general like users would expect.
module Freckle
module Date
class << self
def parse(string)
raw = string.to_s.strip
return nil if raw.empty?
begin
# reverse order if we encounter "European" formatting
@mifix
mifix / Setup and forget Apache Host and PHP configuration
Last active February 22, 2016 03:23
Setup and forget Apache Host and PHP configuration. (VirtualDocumentRoot and php-fpm)
Prerequisites
=============
$ apt-get install apache2-mpm-worker libapache2-mod-fastcgi php5-fpm php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
$ a2enmod actions fastcgi alias rewrite vhost_alias
$ sudo service apache2 reload
@math2001
math2001 / minimap_setting.py
Last active August 14, 2021 17:34
A plugin to hide the minimap using a setting on sublime text.
# -*- encoding: utf-8 -*-
import sublime
import sublime_plugin
class MinimapSetting(sublime_plugin.EventListener):
def on_activated(self, view):
show_minimap = view.settings().get('show_minimap')
if show_minimap:
@dkandalov
dkandalov / long_running_exec.rb
Last active June 2, 2023 14:37
Ruby method to execute and continuously print output of long-running shell command
#!/usr/bin/ruby
require "open4"
def shell_exec(command)
puts("> " + command + "\n")
pid, stdin, stdout, stderr = Open4::popen4(command)
while Process::waitpid(pid, Process::WNOHANG).nil? do
stdout.each_line { |line| puts line }
stderr.each_line { |line| puts line }
sleep(1)
@fum1h1ro
fum1h1ro / SyncAssets
Last active September 13, 2023 07:16
タイムスタンプじゃなくファイルのハッシュで変更を検知するツール
DROPBOX_ROOT = File.expand_path("~/Hoge Dropbox") + "/hoge"
PROJECT_ROOT = "Unity"
ASSETS_ROOT = "#{PROJECT_ROOT}/Assets"
ADDRESSABLE_RESOURCES_ROOT = "#{ASSETS_ROOT}/AddressableResources"
REFERENCED_RESOURCES_ROOT = "#{ASSETS_ROOT}/ReferencedResources"
SPRITES_ROOT = "#{REFERENCED_RESOURCES_ROOT}/Sprites"
BACKGROUND_ROOT = "#{REFERENCED_RESOURCES_ROOT}/Background"
SPINE_CHARACTER_ROOT = "#{REFERENCED_RESOURCES_ROOT}/SpineResources/Characters"
SPINE_EFFECT_ROOT = "#{REFERENCED_RESOURCES_ROOT}/SpineResources/Effects"
SPINE_MAP_ROOT = "#{REFERENCED_RESOURCES_ROOT}/SpineMapResources"
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@bcomnes
bcomnes / git-gpg.md
Last active February 13, 2024 07:33
my version of gpg on the mac
  1. brew install gnupg, pinentry-mac (this includes gpg-agent and pinentry)

  2. Generate a key: $ gpg --gen-key

  3. Take the defaults. Whatevs

  4. Tell gpg-agent to use pinentry-mac:

    $ vim ~/.gnupg/gpg-agent.conf 
    
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@tomas-stefano
tomas-stefano / Capybara.md
Last active May 2, 2024 05:16
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above