/*
Made by [egy.js](https://www.instagram.com/egy.js/);
*/
require 'csv' | |
file = "#{Rails.root}/public/data.csv" | |
table = User.all;0 # ";0" stops output. Change "User" to any model. | |
CSV.open( file, 'w' ) do |writer| | |
writer << table.first.attributes.map { |a,v| a } | |
table.each do |s| | |
writer << s.attributes.map { |a,v| v } |
# Resets the password for the default LXSS / WSL bash user, based on https://askubuntu.com/a/808425/697555 | |
$lxssUsername = (Get-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss).DefaultUsername | |
lxrun /setdefaultuser root | |
bash -c "passwd $lxssUsername" | |
lxrun /setdefaultuser $lxssUsername |
<?php | |
# https://gist.github.com/eric1234/6357465 | |
# | |
# Will render the given template passing on the given params as | |
# variables in that scope. For example: | |
# | |
# partial('hello.php', array('name' => 'Joe')) | |
# | |
# Then your template can have: | |
# |
Writing apps today almost always starts with a framework. Systems such as Ruby on Rails, Django, etc are leading the pack in developing best of breed web frameworks for advanced web apps.
Attempts to copy this style of framework in PHP has largely failed. Systems such as CodeIgniter are buggy and more limited than their counterparts in other languages despite PHP having a much bigger community.
sudo apt-get install -y libsqlite3-dev | |
gem install mailcatcher | |
rbenv rehash | |
cat <<EOF | sudo tee /etc/init/mailcatcher.conf | |
description "Test mail server" | |
start on runlevel [2345] | |
stop on runlevel [016] | |
respawn |
Include this script and all your radio buttons can be unchecked. The result is the radio box group goes back to a state where no radio is checked. Sort of a cross between a radio button and a checkbox. This means your backend should be prepared for that field to be empty even if you populated it when the page was loaded.
This script assumes it is operating in a Turbolinks environment as it initializes
using the page:change
event. If you are not using Turbolinks you will want to
change it to use the jQuery ready event.
Most of programs will not accept an email using just @localhost as domain.
So, edit /etc/hosts
file to make the domain localhost.com point to your machine, including this content to the file:
127.0.0.1 localhost.com
#!/usr/bin/php -q | |
<?php | |
// get mail via stdin | |
$email = file_get_contents("php://stdin"); | |
// handle email | |
$lines = explode("\n", $email); | |
// set empty vars and explode message to variables |