Skip to content

Instantly share code, notes, and snippets.

View yeongsheng-tan's full-sized avatar

Tan Yeong Sheng yeongsheng-tan

View GitHub Profile
@hstaudacher
hstaudacher / junit4-templates.xml
Created March 20, 2012 11:20
JUnit4 Templates for Eclipse
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="setup">${:import(org.junit.Before)}
@Before
public void setUp() {
${cursor}
}</template><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="teardown">${:import(org.junit.After)}
@After
public void tearDown() {
${cursor}
}</template><template autoinsert="false" context="java-members" deleted="false" description="test method" enabled="true" id="org.eclipse.jdt.ui.templates.test" name="test">${:import(org.junit.Test)}
@Test
@harley
harley / rake_benchmark.rb
Created July 14, 2012 22:36
Benchmarking a rake task
# Put this in Rakefile (doesn't matter where)
require 'benchmark'
class Rake::Task
def execute_with_benchmark(*args)
bm = Benchmark.measure { execute_without_benchmark(*args) }
puts " #{name} --> #{bm}"
end
alias_method :execute_without_benchmark, :execute
@Mins
Mins / mysql_secure.sh
Last active May 31, 2024 14:19
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@jwilm
jwilm / mongodb.service
Created June 22, 2013 22:49
MongoDB systemd service unit configuration
[Unit]
Description=MongoDB Database Service
Wants=network.target
After=network.target
[Service]
Type=forking
PIDFile=/var/run/mongodb/mongod.pid
ExecStart=/usr/local/bin/mongod --config /etc/mongod.conf
ExecReload=/bin/kill -HUP $MAINPID
@AlbertMoscow
AlbertMoscow / roman_numerals.exs
Last active October 26, 2019 05:21
Roman Numerals kata implemented in elixir
defmodule RomanNumerals do
@moduledoc """
Task definition: Create a function taking a positive integer as its parameter and
returning a string containing the Roman Numeral representation of that integer.
"""
def convert(number) do
convert(number, [[10,'X'], [9,'IX'], [5,'V'], [4,'IV'], [1,'I']])
end
@thitemple
thitemple / dev_setup.ps1
Last active March 22, 2022 05:19
A PowerShell script for installing a dev machine using Chocolatey.
function Add-Path() {
[Cmdletbinding()]
param([parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)][String[]]$AddedFolder)
# Get the current search path from the environment keys in the registry.
$OldPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
# See if a new folder has been supplied.
if (!$AddedFolder) {
Return 'No Folder Supplied. $ENV:PATH Unchanged'
}
# See if the new folder exists on the file system.
@eshizhan
eshizhan / conv2vmx-ovf.py
Last active April 25, 2021 22:05
a script that can help import VMs into VMware ESXi from VirtualBox. tested vbox 4.2.18 and ESXi 5.1.
#!/usr/bin/env python
#
# usage:
# conv2vmx-ovf.py some-vm.ovf
#
# ref: http://www.cnblogs.com/eshizhan/p/3332020.html
#
import sys
fn = sys.argv[1]
@jhjguxin
jhjguxin / mongodb_security_tour.md
Last active July 14, 2017 03:51
under the replication, how deprecated mongodb `--auth` option instead use network security strategies <br /> base on gxservice
@YungSang
YungSang / README.md
Last active April 3, 2017 09:10
Running Kubernetes Example on CoreOS, Part 2 with flannel (formerly Rudder)
@samselikoff
samselikoff / future-proof.md
Last active April 21, 2023 17:14
Future-proofing your Ember 1.x code

This post is also on my blog, since Gist doesn't support @ notifications.


Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI
  • In general, replace views + controllers with components
  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController
  • Fetch data in your route, and set it as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.